e9卡片式电脑编译关于浮点错误解决方案

我在e9卡片电脑上编译erlang_js,出现了”uses VFP register arguments”的错误

大致内容如下:

ld: error: Linux_All_OPT.OBJ/jsinterp.o uses VFP register arguments, Linux_A    ll_OPT.OBJ/libjs.so does not
ld: failed to merge target specific data of file Linux_All_OPT.OBJ/jsinterp.    o

解决过程

查看gcc的编译器自身的编译选项

gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.6/lto-wrapper
目标:arm-linux-gnueabi
配置为:../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
线程模型:posix
gcc 版本 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

查看gcc支持的库

 gcc -print-multi-lib
.;
.;@mfloat-abi=softfp
hf;@mfloat-abi=hard

解决方法

修改CFLAGS选项进行编译(记得先make clean,对于一些应用,可能还需要重新configure):

CFLAGS="--with-float=softfp --with-fpu=vfpv3-d16 --with-arch=armv7-a" make

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据