[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ next ]

Debian CLI Policy
Chapter 4 - Mono Specific Packaging help

This section offers help with common problems encountered when packaging Mono-specific applications for Debian.

4.1 Naming

The official name of the Mono Project is: Mono, mono:: or mono. To keep this consistent for users, it should always be called "Mono" (not MONO, mono, mono:: or mixed with the .NET name). The explanation of what Mono is, should be in the package long description.

4.2 DLL Maps

Often times, upstream software developers are not packagers, and vice versa. Developers do not necessarily test their software with packaging issues in mind. The most common problem we see from this are missing DLL exceptions.

4.2.1 Introduction

When Mono code invokes an external library, it usually calls something like [DllImport("foo")] which expands "foo" to a shared library name such as "libfoo.so" which is then searched for in the library search path.

In Debian and some other binary Linux distributions, packages are split into runtime and developer (-dev) packages. Since the versioned library libfoo.so.X is usually used at runtime, and libfoo.so is a symlink only used when building against the library, the libfoo.so symlink is in the libfoo-dev package.

When packaging an application which uses libfoo.so normal users should not need the -dev packages installed just to run the application. However, Mono defaults to looking for the unversioned libfoo.so, which is unavailable in the runtime package.

When the DLL map is missing or upstream forgets to install the DLL map, it will result in a DllNotFoundException which will stop the execution of the program.

4.2.2 Solution: DLL map config file

This can be fixed by creating a DLL map for the application exe or for the library DLL that is trying to invoke libfoo.so. If libfoo.so is invoked by the DLL bar.dll, create an xml file, bar.dll.config to tell Mono which .so should be loaded at runtime. bar.dll.config should be installed to the same directory as bar.dll.

               <dllmap dll="foo" target="libfoo.so.0"/>

A config file can contain as many dllmap directives as are needed. If the upstream developer already ships a config file, but it is incomplete, you should create a patch against it in your package.

Most Mono software developers are very helpful people, and will readily accept patches to solve this type of bug if you bring it to their attention. Please be sure to inform them of all these changes.


The Mono runtime uses a shared directory, by default ~/.wapi. This directory will be created/used when any CLI application is executed (like the C# compiler mcs).

There are 2 problems with this:

In these cases, the package building will fail, applications will hang, die with strange Mono runtime errors or segfault. This includes dh_clideps or dh_makeclilibs, since they run monodis.

The solution is to include cli.make from cli-common-dev in debian/rules or to manually set the MONO_DISABLE_SHM environment variable.

             export MONO_DISABLE_SHM = 1

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ next ]

Debian CLI Policy

Version 0.7

Mirco Bauer meebey@debian.org
Brandon Hale brandon@smarterits.com
Sebastian Dröge slomo@debian.org
Dylan R. E. Moonfire debian@mfgames.com