I am trying to load use a native shared library via P/Invoke. However, it won't load from under MonoDevelop. This is the console output with MONO_LOG_LEVEL=debug
and MONO_LOG_MASK=dll
:
Creating a V8Engine instance ...Mono: DllImport attempting to load: 'V8_Net_Proxy'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy': '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy.so': 'libv8-x64.so: cannot open shared object file: No such file or directory'.
However, the libv8-x64.so
is located in the same directory as libV8_Net_Proxy.so
:
/localhome/rryk/v8netmonolinux/Source/bin/Debug [mono-linux *]$ ls
libV8_Net_Proxy.so V8.Net.Console.exe.config V8.Net.dll.mdb V8.Net.Proxy.Interface.x64.dll V8.Net.SharedTypes.dll.mdb x64
libv8-x64.so V8.Net.Console.exe.mdb V8.Net.Proxy.Interface.dll V8.Net.Proxy.Interface.x64.dll.mdb V8.Net.SharedTypes.XML x86
V8.Net.Console.exe V8.Net.dll V8.Net.Proxy.Interface.dll.mdb V8.Net.SharedTypes.dll V8.Net.XML
Even more interesting is that the same very application loads the library just fine when executed from the console:
/localhome/rryk/v8netmonolinux/Source/bin/Debug [mono-linux *]$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll mono V8.Net.Console.exe
Creating a V8Engine instance ...Mono: DllImport attempting to load: 'V8_Net_Proxy'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy': '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy: cannot open shared object file: No such file or directory'.
Mono: DllImport loaded library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy.so'.
I also checked that the same mono binary is used both on the console and in MonoDevelop. In fact I couldn't check which binary is used by MonoDevelop, but .NET Runtimes section in the settings displays version 3.0.12. I only have one Mono binary in the system which has this version and it is the one used on the command line by default (as it's listed first in whichis
):
~$ whereis mono
mono: /usr/bin/mono /etc/mono /usr/lib/mono /usr/bin/X11/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono /usr/share/mono /usr/share/man/man1/mono.1.gz
What can cause the difference? Why doesn't Mono find the libv8-x64.so
, which is located in the same directory?
Try: