make时提示GCC找不到,但又能查到版本问题

daron@daron-virtual-machine:~/linux/tiny6410/linux-2.6.38$ make
make: gcc: Command not found
  HOSTCC  scripts/kconfig/conf.o
/bin/sh: 1: gcc: not found
make[2]: *** [scripts/kconfig/conf.o] Error 127
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'.  Stop.

提示/bin/sh: 1: gcc: not found,但是执行命令arm-linux-gcc -v后
daron@daron-virtual-machine:~/linux/tiny6410/linux-2.6.38$ arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/home/daron/linux/opt/FriendlyARM/toolschain/4.5.1/bin/../libexec/gcc/arm-none-linux-gnueabi/4.5.1/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /work/toolchain/build/src/gcc-4.5.1/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.5.1 --with-sysroot=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --enable-languages=c,c++ --disable-multilib --with-cpu=arm1176jzf-s --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=softfp --with-pkgversion=ctng-1.8.1-FA --with-bugurl=http://www.arm9.net/ --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-gmp=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpfr=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-ppl=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-cloog=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpc=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-libelf=/work/toolchain/build/arm-none-linux-gnueabi/build/static --enable-threads=posix --with-local-prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --disable-nls --enable-symvers=gnu --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.5.1 (ctng-1.8.1-FA)
又能查到gcc的版本信息。
root@daron-virtual-machine:~/linux/tiny6410/linux-2.6.38# cat /proc/version
Linux version 3.13.0-32-generic (buildd@phianna) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #57~precise1-Ubuntu SMP Tue Jul 15 03:51:20 UTC 2014
root@daron-virtual-machine:~/linux/tiny6410/linux-2.6.38# gcc --version
The program 'gcc' can be found in the following packages:
 * gcc
 * pentium-builder
Try: apt-get install

即使重新安装gcc,也不能解决此问题。解决办法如下
解决办法1:
sudo apt-get install build-essential
root@daron-virtual-machine:~/linux# sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following package was automatically installed and is no longer required:
  liblzo2-2
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  g++ gcc
Suggested packages:
  g++-multilib gcc-multilib autoconf automake1.9 libtool flex bison gcc-doc
The following NEW packages will be installed:
  build-essential g++ gcc
0 upgraded, 3 newly installed, 0 to remove and 322 not upgraded.
Need to get 5,114 B/12.4 kB of archives.
After this operation, 115 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main gcc amd64 4:4.6.3-1ubuntu5 [5,114 B]
Fetched 5,114 B in 3s (1,699 B/s)
Selecting previously unselected package gcc.
(Reading database ... 151853 files and directories currently installed.)
Unpacking gcc (from .../gcc_4%3a4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package g++.
Unpacking g++ (from .../g++_4%3a4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package build-essential.
Unpacking build-essential (from .../build-essential_11.5ubuntu2.1_amd64.deb) ...
Processing triggers for man-db ...
Setting up gcc (4:4.6.3-1ubuntu5) ...
Setting up g++ (4:4.6.3-1ubuntu5) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode.
Setting up build-essential (11.5ubuntu2.1) ...
问题解决,再用gcc -v 查找一下gcc的版本,可以找到了,
在make或make menuconfig也没问题了
root@daron-virtual-machine:~/linux/tiny6410/linux-2.6.38# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

以下在网上找的解决办法,没什么卵用,并不适合我这个问题,让我很是纠结,为什么这个不行。
后来发现原因如下:
exportPATH=$PATH:/usr/local/arm/4.4.3/bin
是设置当前用户的PATH,而sudo执行make的时候,使用的是超级用户权限,那也就使用了超级用户的PATH(但是这个PATH里,并没有/usr/local/arm/4.4.3/bin)
 
解决方法:
1.先打开一个超级用户权限的shell:
     命令:sudo –s
2.在当前shell下,设置环境变量:
      命令:gedit /etc/profile
在文件末端加上 export PATH=$PATH:/usr/local/arm/4.4.3/bin,并保存。
3. 执行source /etc/profile    这是避免重新启动ubuntu而又使刚刚修改的环境变量生效的方法。
 
再进入到/opt/FriendlyARM/mini2440/linux-2.6.32.2  目录,执行make zImage(有可能加sudo),
arm-linux-gcc了,可以编译了。

你可能感兴趣的:(make,menuconfig)