AnsweredAssumed Answered

Having problems with Sourcery linker loading Android libraries

Question asked by roger_r_cruz on Aug 26, 2012
Latest reply on Sep 6, 2012 by ricardo_anguiano

I have been using Sourcery Code Bench version arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 to compile an application for Android.  This toolchain worked flawlessly for me in doing the compilation and execution as long as I specified that the application use the Sourcery linker.  I copied the runtime C libraries and linker to the Android emulator prior to the application's execution.  As I said this has worked well.

 

I then changed my application link against another library (call it libA) which uses OpenGL.  I have the source code to libA and it requires being compiled with Android's NDK.  The compilation of libA goes well as expected and I copied to the Android emulator where it can successfully be found by the Sourcery linker as it attempts to load (and resolve dependencies) of my application.

 

The problem I am seeing with the Sourcery linker is when it attempts to resolve the dependencies of libA which are depedencies against NDK libraries.  The linker attempts to load libc and it "hangs" (ie, the application does not show any more output).  Under the debugger and with LD_DEBUG_OUTPUT enabled, I can see the linker is calling libc.so's init routine but it never returns.  I see similar problems with other libraries (libdl.so but not libGLESv1_CM.so or libcutils.so, weird)

 

 

/data/bin/myapp -> /data/lib/libA.so -> /system/lib/libGLESv1_CM.so -> /system/lib/libcutils.so -> /system/lib/libc.so


       375: binding file  /data/bine/myapp [0] to  /data/lib/libA.so [0]: normal symbol `<some symbol being resolved correctly'

       375:

       375: calling init: /system/lib/libc.so

       375:

 

 

Backtrace where my app does a dlopen of the shared library (libA) built with NDK

(gdb) where

#0  0xfffffffe in ?? ()

#1  0x4000fc7c in call_init () from /data/lib/ld-linux.so.3

#2  0x4000fe5c in _dl_init_internal () from /data/lib/ld-linux.so.3

#3  0x400147e8 in dl_open_worker () from /data/lib/ld-linux.so.3

#4  0x4000faf4 in _dl_catch_error () from /data/lib/ld-linux.so.3

#5  0x40014048 in _dl_open () from /data/lib/ld-linux.so.3

#6  0x42487bc4 in dlopen_doit () from /data/lib/libdl.so.2

#7  0x4000faf4 in _dl_catch_error () from /data/lib/ld-linux.so.3 #8  0x424882b8 in _dlerror_run () from /data/lib/libdl.so.2

#9  0x42487c8c in dlopen@@GLIBC_2.4 () from /data/lib/libdl.so.2

 

So my questions,

1) Has anyone have a clue on what is going on or how to debug it? 
2) Has anyone had any success in getting a Sourcery-compiled application load a library compiled with NDK?  If so, how?


Thanks in advance
Roger R. Cruz

Outcomes