[Mono-dev] DllNotFoundException and shared libraries
Andrew Warinner
awarinner at gmail.com
Wed Dec 14 05:11:56 EST 2005
I'm getting a System.DllNotFoundException when attempting to execute a
function in a shared library that in turn executes a function in yet another
shared library.
Here's the function declaration in the C# source:
[DllImport ("libfontinfo.so")]
public static extern int init_font_library();
libfontinfo.so is contained in the ld.so.cache as evidenced by /sbin/ldconfig:
...
libfontinfo.so.1 (libc6) => /usr/lib/libfontinfo.so.1
...
[Aside: I'm running on SUSE 9.3 Pro.]
init_font_library() in turn invokes FT_Init_FreeType:
int error = FT_Init_FreeType(&font_library);
FT_Init_FreeType() is contained in libfreetype.so.
So libfontinfo.so depends on libfreetype.so which is also contained in the
ld.so.cache:
...
libfreetype.so.6 (libc6) => /usr/local/lib/libfreetype.so.6
libfreetype.so.6 (libc6) => /usr/lib/libfreetype.so.6
libfreetype.so (libc6) => /usr/local/lib/libfreetype.so
libfreetype.so (libc6) => /usr/lib/libfreetype.so
...
When executing, tracing reveals the following:
Mono-INFO: DllImport attempting to load: 'libfontinfo.so'.
Mono-INFO: DllImport loading location: 'libfontinfo.so'.
Mono-INFO: DllImport error loading library: '/usr/lib/libfontinfo.so:
undefined symbol: FT_Init_FreeType'.
Mono-INFO: DllImport loading library: './libfontinfo.so'.
Mono-INFO: DllImport error loading library './libfontinfo.so:
undefined symbol: FT_Init_FreeType'.
Mono-INFO: DllImport loading: 'libfontinfo.so'.
Mono-INFO: DllImport error loading library '/usr/lib/libfontinfo.so:
undefined symbol: FT_Init_FreeType'.
(finfotest.exe:16405): Mono-WARNING **: DllImport unable to load
library '/usr/lib/libfontinfo.so: undefined symbol: FT_Init_FreeType'.
Unhandled Exception: System.DllNotFoundException: libfontinfo.so
in (wrapper managed-to-native) FontInfo.DumpFontInfo:init_font_library ()
in <0x00096> FontInfo.DumpFontInfo:Main (System.String[] args)
It appears to me that the problem is not that libfontinfo.so is not not found
but that mono is unable to find or load libfreetype.so that libfontinfo.so uses.
I'm stumped. Any pointers would be welcome.
Andrew Warinner
More information about the Mono-devel-list
mailing list