Android native build of GCC

Cyd Haselton
Sun Feb 15 23:03:00 GMT 2015

On February 15, 2015 12:57:18 PM CST, Alexander Monakov <> wrote:
>On Sun, 15 Feb 2015, Cyd Haselton wrote:
>> On Sun, Feb 15, 2015 at 12:41 PM, Cyd Haselton <>
>> *snip*
>> >
>> >> 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
>> >>
>> *snip*
>> Just a quick update:  RTLD_DEFAULT is definitely not the solution
>> as it results in a segfault when libfakechroot loads.  Perhaps a
>> different RTLD_FLAG was meant?
>I think you need to use RTLD_DEFAULT only when resolving "dlopen", and
>RTLD_NEXT for all other symbol names (unless later on you run into
>symbols with similar behavior).  Something like
>  ... = dlsym(strcmp(name, "dlopen") ? RTLD_NEXT : RTLD_DEFAULT, name);

I believe that worked perfectly; compiling Python no longer causes fakechroot to throw an undefined reference to dlopen().  Many, many thanks.

For my future reference, are there recommended references/documentation for Android's linker in particular and dynamic linking, shared/static libraries, and symbol resolution in general...other than man dlopen/dlsym/etc?

Sent from my Android device with K-9 Mail. Please excuse my brevity.

More information about the Gcc mailing list