Don't version shared libraries on Android.
Wanted: profiler support on Android. ;-)
...which seems sane enough: we have this nifty pluggable profiler
mechanism already, we have profilers built as separate shared libs
(e.g. libmono-profiler-log.so), let's just "somehow" load one, call
the init function, and we're off to the races, right?
void* h = dlopen ("path/to/libmono-profiler-log.so", RTLD_LAZY)
// h == null; dlerror() is:
// Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library
// "libmonosgen-2.0.so.0" needed by "libmono-profiler-log.so"; caused by
// load_library(linker.cpp:745): library "libmonosgen-2.0.so.0" not found
Ouch. So the problem is that libmonosgen-2.0.so contains a versioned
SONAME ("libmonosgen-2.0.so.0"), and thus libmono-profiler-log.so
contains a versioned SONAME reference, which cannot be resolved.
(Android doesn't allow versioned .so's to be placed within .apks.)
Fix the first: make libmonosgen-2.0.so unversioned. That way,
libmono-profiler-log.so contains an unversioned library reference, and
Android is appeased!
(Unversion libmono-profiler-log.so for good measure.)
Fix the second: with the above fix in place, libmono-profiler-log.so
SITLL won't be loaded, with dlerror(3) reporting:
Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate
symbol "monoeg_g_log" referenced by "libmono-profiler-log.so"
The issue here is that libmonosgen-2.0.so contains unexported symbol
references from eglib, e.g. monoeg_g_log(), and dlopen() won't use
those unexported symbols. So just add the glib link references to
libmono-profiler-log.so, and everything is kosher. Yay.