c# - Mono native binary bundle fails to load libc in newer Linux kernels -
i'm attempting build c# mono application native binary can run on linux systems without dependencies (such mono).
to ensure backwards compatibility using ubuntu 12.04 build native binary. had build mono 3.x source ubuntu 12.04 has packages mono 2. documented that process here, if you're interested.
i using mkbundle bundle mono runtime , dependencies:
mkbundle -c -o wftolaunchernative.c -oo bundles.o --static --deps wftolauncher.exe open.nat.dll i using cc compiler so:
cc -o wftolaunchernative.exe wftolaunchernative.c bundles.o -l:libmono-2.0.a -l:libgdiplus.a -lc -lpthread -lrt -lm -ldl -i /usr/local/include/mono-2.0/ this works on system built on (ubuntu 12.04). on ubuntu 14.04 no mono installation following error:
unhandled exception: system.typeinitializationexception: exception thrown type initializer system.windows.forms.xplatui ---> system.dllnotfoundexception: libc ldd of application:
scott@ubuntu:/media/strichnet/wftolauncher/bin/release/linuxnative$ ldd wftolaunchernative.exe linux-vdso.so.1 => (0x00007fffd0ffe000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa6c794a000) /lib64/ld-linux-x86-64.so.2 (0x00007fa6c7d27000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa6c772c000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa6c7523000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa6c721d000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa6c7019000) my hunch far mono @ fault here - think relies on mono dllmap configs map libc libc.so.6, failing. there similar question on , answer here looks promising, goal create independent native assembly not solution can accept.
i have copied default mono 3 config file /etc/mono/config binary directory , renamed wftolauncher.exe.config , wftolaunchernative.exe.config (just in case). has not helped.
full mono debug trace here: https://gist.github.com/strich/e71b23421cdbe941b4f4
the root cause of problem mono looking libc.so os had libc.so.6. mono needs dllmap config file understand how translate this.
the solution problem add default mono3 dllmap config file same directory binary. sadly appears mono doesn't cache dllmap globally process, had make multiple duplicate copies of config file under different names of various modules being called. example:
mono.posix.dll.config system.drawing.dll.config system.windows.forms.dll.config
Comments
Post a Comment