问题现象:
使用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
到此,编译即可通过。