On Sun, Feb 15, 2015 at 11:53 AM, Alexander Monakov <amona...@ispras.ru> wrote: >> Given that info...and in spite of my aforementioned limited knowledge I >> went back to take another look at the source and found this in >> libfakechroot.c >> >> /bld/fakechrt/fakechroot-2.16 $ grep -C 4 dlsym src/libfakechroot.c >> /* Lazily load function */ >> LOCAL fakechroot_wrapperfn_t fakechroot_loadfunc (struct fakechroot_wrapper >> * w) >> { >> char *msg; >> if (!(w->nextfunc = dlsym(RTLD_NEXT, w->name))) {; >> msg = dlerror(); >> fprintf(stderr, "%s: %s: %s\n", PACKAGE, w->name, msg != NULL ? msg >> : "unresolved symbol"); >> exit(EXIT_FAILURE); >> } >> >> I'm fairly certain I remember reading something about Android and lazy >> function loading....how it doesn't handle it well or does so differently >> from standard Linux builds. At any rate, I believe the above code is >> responsible for those annoying 'fakechroot: undefined reference to dlopen' >> errors, so I'll see if I can fix that. > > In Android's Bionic libc, the implementation of dlopen() resides in the > dynamic loader, and not present in libdl.so.
Yet in Android's NDK documentation, they state that in order to use dlopen() functionality in native code you must link against libdl and include dlfcn.h. Why would this be the case if the dlopen() implementation is not in libdl? (documentation link: http://www.kandroid.org/ndk/docs/STABLE-APIS.html) > So to obtain the pointer to > dlopen the code like above can use dlsym(RTLD_DEFAULT, "dlopen"), but not > RTLD_NEXT (the loader precedes the fakeroot library in the lookup chain). > > The preceding discussion seems to have libc and libdl switched. Normally the > implementation of dlopen is found in libdl.so, but not in libc.so. > So in standard Linux builds, libc.so doesn't contain the dlopen() implementation...as in Android? > Hope that helps, > Alexander It saves me a lot of time poring through reams of speculation, verbiage and complicated example code about Android's sparse documentation so, thanks.