交叉编译需要 configure的代码

本文介绍如何通过修改configure脚本来实现交叉编译。主要步骤包括将交叉编译工具链加入到PATH环境变量,并使用--host参数指定目标平台的工具链前缀。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

很多代码都有 configure文件,需要执行一下  configure 才能产生Makefile。

如果要对这样的代码进行交叉编译,需要做一些设置。

首先,把交叉工具链的位置加入到 PATH里,

然后执行 ./configure --host=cross-compile-prefix

就可以了。

比如,我现在用的  arm gcc名称为arm-linux-gnueabi-gcc, 前缀为  arm-linux-gnueabi

所以在我编一个代码的时候,执行configure的结果如下:

$ ./configure --host=arm-linux-gnueabi
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabi
checking target system type... arm-unknown-linux-gnueabi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-gnueabi-strip... arm-linux-gnueabi-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether #! works in shell scripts... yes
checking for style of include used by make... GNU
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 dependency style of arm-linux-gnueabi-gcc... gcc3
checking how to run the C preprocessor... arm-linux-gnueabi-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for Minix Amsterdam compiler... no
checking for arm-linux-gnueabi-ar... arm-linux-gnueabi-ar
checking for arm-linux-gnueabi-ranlib... arm-linux-gnueabi-ranlib
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值