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



On February 14, 2015 5:08:23 AM CST, Andrew Haley <aph@redhat.com> wrote:
>On 13/02/15 22:40, Cyd Haselton wrote:
>> Somehow these calls are passed  to libc by the wrapper including the
>dlopen() call...which fails because it should be passed to libdl on
>android.
>> 
>> How the wrapper points to libc I have no idea.  Why the wrapper
>around dlopen doesn't pick up 0n the linked libdl.so...again, I have no
>idea.  Someone with better knowledge of fakechroot internals, symbols
>and linking will have to tackle this.
>
>Ah, I think I might know.  When you call dlsym() you have the option
>of passing a handle to the library you want to search.  Usually
>dlsym() searches all loaded libraries, but it's possible that
>libfakechroot specifies that only libc is searched.
>
>Andrew.

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.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


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