gcc 编译程序错误: as: unrecognized option ‘--64‘

问题现象:
使用gcc编译程序(简单如helloworld),出现如下错误:

gcc demo.c thread_pool.c -o demo -lpthread
as: unrecognized option '--64'
as: unrecognized option '--64'
Makefile:2: recipe for target 'make' failed
make: *** [make] Error 1

解决方法:

1. 查看as位置:
 whereis as
as: /usr/bin/as /home/tan/Documents/code_exercise/esp/crossTools/xtensa-esp32-elf/xtensa-esp32-elf/bin/as /usr/arm-linux-gnueabi/bin/as /usr/share/man/man1/as.1.gz

which as
/home/tan/Documents/code_exercise/esp/crossTools/xtensa-esp32-elf/xtensa-esp32-elf/bin/as

从上述可以发现,gcc调用的esp32编译器中的as,所以只需要将其改变为系统gcc使用的as即可。

2. 在~/.bashrc中添加系统as环境位置,文件中最后一行添加如下:
export PATH=/usr/bin:$PATH
3. 更新环境
source ~/.bashrc
4.查看命令位置,发现as命令位置已经修改:
which as
/usr/bin/as

到此,编译即可通过。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值