wwa*_*bik 8 x86 static android android-ndk libm
在尝试使用最近的android-9 x86平台编译源代码时遇到问题.
主要问题:为什么静态库libm.a和动态libm.so不同?
问题是我试图编译:
/path/to/android-ndk-r8/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux-gcc --sysroot =/path/to/android-ndk-r8/platforms/android-9/arch-x86 -I/path/to/android-ndk-r8/sources/cxx-stl/gnu-libstdc ++/include -I/path/to/android-ndk-r8/sources/cxx-stl/gnu-libstdc ++/libs/x86/include -L/path/to/android-ndk -r8/sources/cxx-stl/gnu-libstdc ++/lib -L / path/to/android-ndk-r8/platforms/android -9/arch-x86/usr/lib -static /path/to/gcc_4_4_6_release/gcc/testsuite/gcc.dg/complex-5.c-std = c99 -O -ffloat-store -o ./complex-5. exe -lm
但我有未定义的参考:
/tmp/cc78CsCp.o:在函数
main': complex-5.c:(.text+0x1a2): undefined reference tofeclearexcept'complex-5.c :(.text + 0x1b3):未定义引用`fetestexcept'colle2:ld返回1退出状态pwd:/ path/to/android-ndk-r8/platforms/android-9/arch-x86/usr/lib
ls libm*libm.a libm.so
它存在,但是如果我们用nm来表示feclearexcept,它就不存在于静态库中.
好的,只是尝试删除-static标志.
/path/to/android-ndk-r8/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux-gcc --sysroot =/path/to/android-ndk-r8/platforms/android-9/arch-x86 -I/path/to/android-ndk-r8/sources/cxx-stl/gnu-libstdc ++/include -I/path/to/android-ndk-r8/sources/cxx-stl/gnu-libstdc ++/libs/x86/include -L/path/to/android-ndk -r8/sources/cxx-stl/gnu-libstdc ++/lib -L / path/to/android-ndk-r8/platforms/android -9/arch-x86/usr/lib /path/to/gcc_4_4_6_release/gcc/testsuite/gcc.dg/complex-5.c -std = c99 -O -ffloat-store -o ./complex-5.exe - LM
好.那个问题:他们为什么不同?我需要静态链接,我不想强制使用动态链接-Wl,-Bdynamic -lm.顺便说一句:常规linux libm.a和libm.so包含类似的函数列表.