libnanomsg.so, i.e. the SDK / development symlink doesn't exist in production.
Try to look for these library names in order before falling back to the development symlink name:
libnanomsg.so.5 (only exists with properly packaged recent nanomsg)
libnanomsg.so.5.1.0 (nanomsg 1.1.x)
libnanomsg.so.5.0.0 (nanomsg 0.9-beta - 1.0.x)
libnanomsg.so.4.0.0 (nanomsg 0.8-beta)
libnanomsg.so.3.0.0 (nanomsg 0.7-beta)
libnanomsg.so.0 (nanomsg 0.6-beta or older)
libnanomsg.so (fallback to the SDK symlink or the shipped version)
Also, look into these directories in order to fetch the correct library:
/usr/local/lib32 if running on 32-bit (Debian/Ubuntu style)
/usr/local/lib64 if running on 64-bit (Red Hat/SuSE style)
/usr/local/lib
/usr/lib32 if running on 32-bit (Debian/Ubuntu)
/usr/lib64 if running on 64-bit (Red Hat/SuSE style)
/usr/lib
Mono directories
application directory
The same problem is true for libdl.so (i.e. it doesn't exist without SDK packages), so we should use
[DllImport("__Internal")] for dlopen(), dlerror() and dlsym().
Also renamed 3 *.cs files so their name matches the case sensitive spelling in NNanomsg.csproj.
This way, the main NNanomsg.dll can be built on Linux with Mono.
libnanomsg.so, i.e. the SDK / development symlink doesn't exist in production.
Try to look for these library names in order before falling back to the development symlink name: libnanomsg.so.5 (only exists with properly packaged recent nanomsg) libnanomsg.so.5.1.0 (nanomsg 1.1.x) libnanomsg.so.5.0.0 (nanomsg 0.9-beta - 1.0.x) libnanomsg.so.4.0.0 (nanomsg 0.8-beta) libnanomsg.so.3.0.0 (nanomsg 0.7-beta) libnanomsg.so.0 (nanomsg 0.6-beta or older) libnanomsg.so (fallback to the SDK symlink or the shipped version)
Also, look into these directories in order to fetch the correct library: /usr/local/lib32 if running on 32-bit (Debian/Ubuntu style) /usr/local/lib64 if running on 64-bit (Red Hat/SuSE style) /usr/local/lib /usr/lib32 if running on 32-bit (Debian/Ubuntu) /usr/lib64 if running on 64-bit (Red Hat/SuSE style) /usr/lib Mono directories application directory
The same problem is true for libdl.so (i.e. it doesn't exist without SDK packages), so we should use [DllImport("__Internal")] for dlopen(), dlerror() and dlsym().
Also renamed 3 *.cs files so their name matches the case sensitive spelling in NNanomsg.csproj. This way, the main NNanomsg.dll can be built on Linux with Mono.