[英]Cross-compiling for ARM with Autoconf
我无法使用autconf为我的arm板交叉编译库。
我正在使用这一行:
./configure --target=arm-linux --host=arm-linux --prefix=/bla/bla/bla/linux_arm_tool CFLAGS='-m32'
make
make install
当我做file
检查时,我得到:
libjpeg.so.8.4.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
这看起来根本不对,但无论如何我都尝试使用它......我得到:
/usr/lib/gcc/arm-linux-gnueabi/4.5.3/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /bla/bla/bla/bla/../linux_arm_tool/lib/libjpeg.so when searching for -ljpeg
我很茫然,我一直在谷歌上搜索一小时......
所以我知道在使用真正基本的方法调用之前我已经交叉编译了,并且在检查输出之前我弄清楚为什么我已经忘记了这个:
checking for arm-linux-gnueabi-gcc... no
checking for gcc... gcc
...
...
checking for arm-linux-gnueabi-gcc... gcc
在我的/usr/bin
中没有arm-linux-gnueabi-gcc
,我不得不:
ln -s /usr/bin/arm-linux-gnueabi-gcc-4.5 /usr/bin/arm-linux-gnueabi-gcc
我成功交叉编译使用:
./configure --host=arm-linux-gnueabi -prefix=${CSTOOL_DIR}/linux_arm_tool
至于链接......我仍然需要检查一些东西,但我会假设我可能需要在更高级的编译中抛出一些-rpath-link
标志。
我认为问题可以更普遍地重申:“我如何使用Autoconf来交叉编译ARM?”
根据./configure -h
:
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
官方GNU文档有助于回答这个问题:
注意,当他们定义--host
和--build
的用法时:
Therefore, whenever you specify --host, be sure to specify --build too.
以下是我刚用于为嵌入式ARM平台配置iperf
的示例:
首先,“./ configure”脚本实际上被称为“Autoconf”,它真的有助于谷歌搜索。 这里的想法是:
给出正确的--host和--build
buildpath <--- my little script to setup my $PATH export CC=arm_v5t_le-gcc export CXX=arm_v5t_le-g++ ./configure --host=armv5tl-montavista-linux-gnueabi --build=x86_64-linux-gnu
您需要覆盖环境变量CC,LD和其他相关的变量。 设置这些开关并不能告诉您的交叉工具链在哪里(它可能在任何地方)
查看各种项目的一些指南,例如: http : //wiki.wxwidgets.org/Cross-Compiling_Under_Linux
另外,这是我为node.js设置交叉编译的脚本 - 同样的想法: https : //gist.github.com/edhemphill/5094239
libjpeg不会工作b / c它是x86二进制文件,你需要它说:
ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped
或类似的。
这就是你skipping incompatible
的原因
# Install arm-linux-gnueabi packages apt-get install libc6-armel-cross libc6-dev-armel-cross \\ binutils-arm-linux-gnueabi arm-linux-gnueabi-gcc libncurses5-dev ./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi ... checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether arm-linux-gnueabi-gcc accepts -g... yes checking for arm-linux-gnueabi-gcc option to accept ISO C89... none needed checking whether arm-linux-gnueabi-gcc understands -c and -o together... yes checking whether make supports the include directive... yes (GNU style) checking dependency style of arm-linux-gnueabi-gcc... gcc3 ... make arm-linux-gnueabi-gcc -DPACKAGE_NAME=\\"Tutorial\\ Program\\" -DPACKAGE_TARNAME=\\"tutorial-program\\" -DPACKAGE_VERSION=\\"1.0\\" -DPACKAGE_STRING=\\"Tutorial\\ Program\\ 1.0\\" -DPACKAGE_BUGREPORT=\\"\\" -DPACKAGE_URL=\\"\\" -DPACKAGE=\\"tutorial-program\\" -DVERSION=\\"1.0\\" -I. -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.