简体   繁体   中英

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$PLATFORM/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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM