ubuntu64位交叉编译flex为32位程序

首先尝试交叉编译,查看./configure-h后,使用./configure --HOST=i386 编译在这里插入图片描述
通过以上可看出编译仍为64位。
查阅博客,得知需首先安装安装依赖包m4、autoconf、automake、libtool和gettext,下载解压后尝试运行./autogen.sh 报出如下错误:

autoreconf: failed to run autopoint: No such file or directory
autoreconf: autopoint is needed because this package uses Gettext

可知此时本机已含有上述四个依赖,但是缺少autopoint,安装此依赖:

sudo apt-get install autopoint

再次运行./autogen.sh ,无错误,尝试编译,此时本机含有的交叉编译工具链为i586,如下:

./configure --host=i586-linux-gcc

checking build system type... x86_64-pc-linux-gnu
checking host system type... Invalid configuration `i586-linux-gcc': system `gcc' not recognized
configure: error: /bin/bash build-aux/config.sub i586-linux-gcc failed

如上报出找不到编译工具链,再次添加CC参数,尝试如下:

sudo ./configure --host=i586-linux-gcc CC=i586-linux-gcc

错误与上一致

checking build system type... x86_64-pc-linux-gnu
checking host system type... Invalid configuration `i586-linux-gcc': system `gcc' not recognized
configure: error: /bin/bash build-aux/config.sub i586-linux-gcc failed

怀疑没有找到对应编译器导致,将CC参数添加绝对路径尝试成功

sudo ./configure --host=i586-linux CC=/home/ubuntu/.../.../..../.../.../.../../bin/i586-linux-gcc
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating examples/Makefile
config.status: creating examples/fastwc/Makefile
config.status: creating examples/manual/Makefile
config.status: creating po/Makefile.in
config.status: creating src/Makefile
config.status: creating tools/Makefile
config.status: creating tests/Makefile
config.status: creating src/config.h
config.status: executing libtool commands
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

接下来的make与make install 均成功执行

交叉编译flex
交叉编译详解
交叉编译心得和注意事项

以上为个人笔记,其中的深层缘由暂未了解,其中的解决方法来源于网上各位大佬的解答分享和自己的推测和实践得来,若有不对的地方,请大家指教,谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值