Search code examples
javaandroidc++android-ndkandroid-4.2-jelly-bean

Cannot load library: soinfo_relocate(linker.cpp:987): cannot locate symbol "wait4" referenced by "libcoresdkinterface-jni.so


I am adding Jelly Beans Support to my Android Kitkat application. I have mentioned minsdk version as 16 and targerSdk version as 19. Currently I am building it against API level 19. After build when I run it on my Jelly Bean device, It crashes with error mentioned as the title of this question.

I got to know that to avoid this error, I need to build my native against Android toolchain generated for API level 16 (since Jelly beans starts from api level 16). I have Android NDK Version android-ndk-r10d. So I went to my NDK directory and used the following command to create a standalone toolchain for API level 16.

build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.8 --platform=android-16 --install-dir=/usr/lo0cal/android-toolchain-16/

Above command created a directory named android-toolchain-16/ in /usr/local/. I added the the path /usr/lo0cal/android-toolchain-16/bin to my PATH variable.

Then I went on and build my native using the script I have. Then I built my app and tried. But it still crashes. Do I need to download a lower version of Android NDK? Because right now I am using android-ndk-r10d. As I found from the web, android-ndk-8b was released right after API level 16.

Or what else I can do? I am using OS X 10.9.5 with i5 (64 bit).


Solution

  • I got the answer for the problem . wait4 function comes from wait.h file , which is present in my SYSROOT at two places :- $SYSROOT/usr/include/linux/wait.h $SYSROOT/usr/include/sys/wait.h. wait.h coming from 'sys' folder has the definition of wait4 method .In my case it had included wait.h coming from 'linux' folder . As soon as i change the #include "wait.h" to #include "sys/wait.h" . It works.