Cross-compiling GSL 1.16 for ARM

风流意气都作罢 提交于 2019-12-11 08:52:55

问题


I am trying to cross-compile the GNU Scientific Library (gsl, v1.16) for ARM architecture (specifically the Raspberry Pi). I have used the following to configure;

CROSS=armv6j-hardfloat-linux-gnueabi
./configure --host=x86_64-pc-linux-gnu --build=$CROSS --target=$CROSS \
CC=/usr/bin/$CROSS-gcc \
CXX=/usr/bin/$CROSS-g++ \
AR=/usr/bin/$CROSS-ar \
RANLIB=/usr/bin/$CROSS-ranlib \
CFLAGS="-march=armv6 -mfloat-abi=hard -mfpu-vfp"

I get the following error messages:

libtool: compile:  /usr/bin/armv6j-hardfloat-linux-gnueabi-gcc 
-DHAVE_CONFIG_H -I. -I.. -I.. -march=armv6 -mfloat-abi=hard -mfpu=vfp 
-MT read.lo -MD -MP -MF .deps/read.Tpo -c read.c -o read.o
In file included from fp.c:10:0:
fp-gnux86.c: In function 'gsl_ieee_set_mode':
fp-gnux86.c:42:15: error: '_FPU_SINGLE' undeclared (first use in this function)
fp-gnux86.c:42:15: note: each undeclared identifier is reported only once for each function it appears in
fp-gnux86.c:45:15: error: '_FPU_DOUBLE' undeclared (first use in this function)
fp-gnux86.c:48:15: error: '_FPU_EXTENDED' undeclared (first use in this function)
fp-gnux86.c:57:15: error: '_FPU_RC_NEAREST' undeclared (first use in this function)
fp-gnux86.c:60:15: error: '_FPU_RC_DOWN' undeclared (first use in this function)
fp-gnux86.c:63:15: error: '_FPU_RC_UP' undeclared (first use in this function)
fp-gnux86.c:66:15: error: '_FPU_RC_ZERO' undeclared (first use in this function)
fp-gnux86.c:76:13: error: '_FPU_MASK_DM' undeclared (first use in this function)
make[2]: *** [fp.lo] Error 1

I am compiling on a 64 bit Linux Gentoo system. I have used the Gentoo toolchain to set-up my cross-compiler. Any pointers to what I am doing wrong are highly appreciated.

Thanks in advance!


回答1:


Your configuration was not correct ,to Cross-compile build=(your x86 gcc),and host=target=(arm-tool-chain).Try this below command.

./configure --host=armv6j-hardfloat-linux-gnueabi --build=x86_64-pc-linux-gnu --target=armv6j-hardfloat-linux-gnueabi \ CFLAGS="-march=armv6 -mfloat-abi=hard -mfpu-vfp"




回答2:


I can't promise it'll work but you'd probably have better luck using the emerge wrapper.

armv6j-hardfloat-linux-gnueabi-emerge gsl

I've worked on a collection of scripts that make this sort of thing more reliable but unfortunately I got tangled up in the hell that is cross-compiling Python modules and never got it into a releasable state.



来源:https://stackoverflow.com/questions/18336369/cross-compiling-gsl-1-16-for-arm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!