Error when using static libraries in Android NDK
I got this error when trying to use a static library:
/home/user/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld:
skipping incompatible /home/user/android-ndk-r5b/apps/HelloNDK/obj/local/armeabi/libtest.a when searching for -ltest
In what may be the problem? Thanks in advance
UPDATE: To compile I've done this:
PREBUILT=/home/user/android-ndk/build/prebuilt/linux-x86/arm-eabi-4.4.0
PLATFORM=/home/user/android-ndk/build/platforms/android-3/arch-arm
INSTALL=/home/user/test-14.3.2/com5
./configure --build=arm \
--prefix=$INSTALL \
--with-flac=dyn \
--enable-static \
CC=$PREBUILT/bin/arm-eabi-gcc \
CFLAGS="-fPIC -DANDROID" \
LDFLAGS="-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLA开发者_运维知识库TFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-eabi/4.4.0/crtbegin.o $PREBUILT/lib/gcc/arm-eabi/4.4.0/crtend.o -lc -lm -ldl"
What's wrong?
You got an hint from the linker : the library seems to be found, but skipped as incorrect.
Are you sure you compiled your library with the same compiler ? If it's compiled for another platform / with another compiler, you'll have an ABI issue and the linker will discard the lib, which it seems to do.
精彩评论