This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Android native build of GCC
- From: Cyd Haselton <chaselton at gmail dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: Hans-Peter Nilsson <hp at bitrange dot com>,"gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Sun, 15 Feb 2015 06:07:52 -0600
- Subject: Re: Android native build of GCC
- Authentication-results: sourceware.org; auth=none
- References: <54AE581C dot 5070003 at redhat dot com> <alpine dot BSF dot 2 dot 02 dot 1502060258210 dot 10842 at arjuna dot pair dot com> <54D48673 dot 9070901 at redhat dot com> <alpine dot BSF dot 2 dot 02 dot 1502060458370 dot 29537 at arjuna dot pair dot com> <54D49731 dot 7030407 at redhat dot com> <F47323AC-2C7B-47B8-B630-D03A629DD347 at gmail dot com> <54D4A6C2 dot 1040808 at redhat dot com> <CAHu5Prbo2J1p2ueC3G5A6r-ZUo0z6JG1X_9OmshEyKPjjh0hTQ at mail dot gmail dot com> <54D4EA79 dot 10909 at redhat dot com> <6A2D97AB-19B8-4A78-ABE7-B486D1C41FCC at gmail dot com> <54DB14AB dot 3040501 at redhat dot com> <87A6FCF6-9A36-43DE-9981-6663EF51D81F at gmail dot com> <54DB3CB7 dot 1040108 at redhat dot com> <9EFDD493-55C2-4E38-B631-48296428F0AE at gmail dot com> <54DF2CA7 dot 3050303 at redhat dot com>
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.