This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Android native build of GCC


> 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.  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.

Hope that helps,
Alexander


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]