当进行make命令学习是出现error trying to exec 'cc1': execvp: No such file or directory

本文详细介绍了在Ubuntu环境下配置arm交叉编译环境遇到的问题及解决方法,包括修改PATH路径、确保gcc与arm-linux-gcc指向正确目录等步骤,最终成功解决了尝试执行'cc1'时出现的错误。

今天在学习make命令时,进行编译的时候总是会出现这种状况

error trying to exec 'cc1': execvp: No such file or directory

自己把程序改了又改,改的很简单之后还是出现这种状况,发现不是我代码的问题,然后去网上查资料,得到了满足我自己状况的解决办法。

(有可能每个人面对的突发状不一样,应该多去找几种解决办法,最终将会找到满足自己的解决方案)

我自己的请款是在Ubuntu下安装了arm'的交叉编译环境,在更改PATH时更改如下:

export PATH=/usr/local/arm/4.3.2/bin:$PATH
export TOOLCHAIN=/usr/local/arm/4.3.2

当你在gcc -v的时候会发现当前的环境变量 gcc(系统编译器?个人理解) 和arm-linux-gcc (交叉编译器)都指向了交叉编译器/home/arm-2008q3/bin

然后进入/usr/local/arm/4.7.3/libexec/gcc/arm-none-linux-gnueabi/4.7.3/会发现下面存在一个cc1,

需要将gcc的PATH指向 /usr/bin

打开/etc/profile

将/usr/bin添加到PATH中,修改后如下

export PATH=/usr/bin:/usr/local/arm/4.3.2/bin:$PATH
export TOOLCHAIN=/usr/local/arm/4.3.2

(注意红色部分)

修改后别忘了 source /etc/profile

让修改的部分生效

然后在运行gcc -v 会看到最后一行的结果与修改前的最后一行会有差别

在运行arm-linux-gcc -v 时,结果还是和修改前相同,这样再进行make命令是就不会出现error trying to exec 'cc1': execvp: No such file or directory这种错误了。


bell@bell-virtual-machine:~/nm/openwrt-15.05.1$ make V=s -j4 make[1]: Entering directory '/home/bell/nm/openwrt-15.05.1' make[2]: Entering directory '/home/bell/nm/openwrt-15.05.1' make[2]: Entering directory '/home/bell/nm/openwrt-15.05.1' + mkdir -p /home/bell/nm/openwrt-15.05.1/staging_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi + mkdir -p /home/bell/nm/openwrt-15.05.1/staging_dir/host + cd /home/bell/nm/openwrt-15.05.1/staging_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi + mkdir -p bin lib include stamp + cd /home/bell/nm/openwrt-15.05.1/staging_dir/host + mkdir -p bin lib include stamp mkdir -p /home/bell/nm/openwrt-15.05.1/build_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi/stamp mkdir -p /home/bell/nm/openwrt-15.05.1/build_dir/host/stamp /home/bell/nm/openwrt-15.05.1/staging_dir/host/include/sys touch /home/bell/nm/openwrt-15.05.1/staging_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi/.prepared install -m0644 /home/bell/nm/openwrt-15.05.1/tools/include/*.h /home/bell/nm/openwrt-15.05.1/staging_dir/host/include/ install -m0644 /home/bell/nm/openwrt-15.05.1/tools/include/sys/*.h /home/bell/nm/openwrt-15.05.1/staging_dir/host/include/sys/ ln -sf lib /home/bell/nm/openwrt-15.05.1/staging_dir/host/lib64 touch /home/bell/nm/openwrt-15.05.1/staging_dir/host/.prepared make[3]: Entering directory '/home/bell/nm/openwrt-15.05.1/tools/patch' make[3]: Entering directory '/home/bell/nm/openwrt-15.05.1/tools/make-ext4fs' make[3]: Entering directory '/home/bell/nm/openwrt-15.05.1/tools/sstrip' rm -rf /home/bell/nm/openwrt-15.05.1/staging_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi/root-realview make[2]: Leaving directory '/home/bell/nm/openwrt-15.05.1' make[3]: Entering directory '/home/bell/nm/openwrt-15.05.1/tools/firmware-utils' gcc -O2 -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/include -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/usr/include -include endian.h -o /home/bell/nm/openwrt-15.05.1/build_dir/host/sstrip/sstrip src/sstrip.c gcc: error trying to exec 'cc1': execvp: No such file or directory Makefile:25: recipe for target '/home/bell/nm/openwrt-15.05.1/build_dir/host/sstrip/.built' failed make[3]: *** [/home/bell/nm/openwrt-15.05.1/build_dir/host/sstrip/.built] Error 1 make[3]: Leaving directory '/home/bell/nm/openwrt-15.05.1/tools/sstrip' tools/Makefile:122: recipe for target 'tools/sstrip/compile' failed make[2]: *** [tools/sstrip/compile] Error 2 make[2]: *** Waiting for unfinished jobs.... (cd /home/bell/nm/openwrt-15.05.1/build_dir/host/patch-2.7.5/; if [ -x configure ]; then cp -fpR /home/bell/nm/openwrt-15.05.1/scripts/config.{guess,sub} /home/bell/nm/openwrt-15.05.1/build_dir/host/patch-2.7.5// && bash ./configure CC="gcc" CFLAGS="-O2 -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/include -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/usr/include" CPPFLAGS="-I/home/bell/nm/openwrt-15.05.1/staging_dir/host/include -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/usr/include" LDFLAGS="-L/home/bell/nm/openwrt-15.05.1/staging_dir/host/lib -L/home/bell/nm/openwrt-15.05.1/staging_dir/host/usr/lib" SHELL="/usr/bin/env bash" --target=x86_64-linux-gnu --host=x86_64-linux-gnu --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/home/bell/nm/openwrt-15.05.1/staging_dir/host --exec-prefix=/home/bell/nm/openwrt-15.05.1/staging_dir/host --sysconfdir=/home/bell/nm/openwrt-15.05.1/staging_dir/host/etc --localstatedir=/home/bell/nm/openwrt-15.05.1/staging_dir/host/var --sbindir=/home/bell/nm/openwrt-15.05.1/staging_dir/host/bin ; fi ) make[3]: Leaving directory '/home/bell/nm/openwrt-15.05.1/tools/make-ext4fs' mkdir -p /home/bell/nm/openwrt-15.05.1/build_dir/host/firmware-utils/bin gcc -O2 -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/include -I/home/bell/nm/openwrt-15.05.1/staging_dir/host/usr/include -include endian.h -L/home/bell/nm/openwrt-15.05.1/staging_dir/host/lib -L/home/bell/nm/openwrt-15.05.1/staging_dir/host/usr/lib -o /home/bell/nm/openwrt-15.05.1/build_dir/host/firmware-utils/bin/addpattern src/addpattern.c gcc: error trying to exec 'cc1': execvp: No such file or directory Makefile:82: recipe for target '/home/bell/nm/openwrt-15.05.1/build_dir/host/firmware-utils/.built' failed make[3]: *** [/home/bell/nm/openwrt-15.05.1/build_dir/host/firmware-utils/.built] Error 1 make[3]: Leaving directory '/home/bell/nm/openwrt-15.05.1/tools/firmware-utils' tools/Makefile:122: recipe for target 'tools/firmware-utils/compile' failed make[2]: *** [tools/firmware-utils/compile] Error 2 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking for x86_64-linux-gnu-gcc... gcc checking whether the C compiler works... no configure: error: in `/home/bell/nm/openwrt-15.05.1/build_dir/host/patch-2.7.5': configure: error: C compiler cannot create executables See `config.log' for more details Makefile:21: recipe for target '/home/bell/nm/openwrt-15.05.1/build_dir/host/patch-2.7.5/.configured' failed make[3]: *** [/home/bell/nm/openwrt-15.05.1/build_dir/host/patch-2.7.5/.configured] Error 77 make[3]: Leaving directory '/home/bell/nm/openwrt-15.05.1/tools/patch' tools/Makefile:122: recipe for target 'tools/patch/compile' failed make[2]: *** [tools/patch/compile] Error 2 make[2]: Leaving directory '/home/bell/nm/openwrt-15.05.1' tools/Makefile:121: recipe for target '/home/bell/nm/openwrt-15.05.1/staging_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy' failed make[1]: *** [/home/bell/nm/openwrt-15.05.1/staging_dir/target-arm_mpcore+vfp_uClibc-0.9.33.2_eabi/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy] Error 2 make[1]: Leaving directory '/home/bell/nm/openwrt-15.05.1' Build failed - please re-run with -j1 to see the real error message /home/bell/nm/openwrt-15.05.1/include/toplevel.mk:181: recipe for target 'world' failed make: *** [world] Error 1 既然cc1在,为啥编译时会如上报错
08-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值