I have played with the new "mkbundle --simple ... --library ..." to bundle native libraries. While libraries with
simple dependencies (i.e. not depending on anything else other than system libraries) are fine, the new mechanism can't cope with secondary dependencies.
I tried changing the dependencies to @loader_path and there is what it says:
dlopen(/var/folders/1p/gc7gfjfj5vx2t8smh_bx65h40000gn/T/mono-bundle-tZ6AeJ/libcairo.2.dylib, 9): Library not loaded:
Reason: image not found
libcairo.2.dylib is as from mono 5.2.0 but modified to look like this (note the @loader_path entries):
$ otool -L libs/libcairo.2.dylib
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/libcairo.2.dylib (compatibility version 11203.0.0, current version 11203.14.0)
@loader_path/libpixman-1.0.dylib (compatibility version 31.0.0, current version 31.0.0)
@loader_path/libfontconfig.1.dylib (compatibility version 8.0.0, current version 8.2.0)
@loader_path/libfreetype.6.dylib (compatibility version 17.0.0, current version 17.2.0)
@loader_path/libpng14.14.dylib (compatibility version 27.0.0, current version 27.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.14.0)
Oh, I realize one subtlety - it is saving and dl_opening one at a time, according to the code https://github.com/mono/mono/blob/master/mono/mini/main.c Line 274. Therefore the --library arguments needs to be listed in dependency order.
I'll give it a try...
Specifying the library list in dependency order does allow the result to launch.
This needs to be added to the documentation/help :-).
I created https://github.com/mono/mono/pull/5495 to update the man page.
For the record, my initial mistake was doing it in alphabetical order (c before p).
It should not be an issue for it to be merged, so I am closing this now.