12

I was cross-compiling a Linux kernel for my Raspberry Pi on a laptop (running debian 7) (followed the instructions in Raspberry Pi Kernel Compilation); but when compiling with

make ARCH=arm CROSS_COMPILE=${CCPREFIX}

I get the following messages:

  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
gcc: error trying to exec 'cc1': execvp: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

I figured that the problem was that cc1 couldn't be found or that gcc was not properly installed (and so I re-installed gcc with apt-get --reinstall install gcc but no luck).

gcc -v gives:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --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.7 --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 --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)

gcc -print-prog-name=cc1 gives:

/usr/lib/gcc/i486-linux-gnu/4.7/cc1

gcc -print-search-dirs gives:

install: /usr/lib/gcc/i486-linux-gnu/4.7/
programs: =/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/bin/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/bin/i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/bin/
libraries: =/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/:/lib/i486-linux-gnu/4.7/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i486-linux-gnu/4.7/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../:/lib/:/usr/lib/

and find / -type f -name cc1 gives:

/opt/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/libexec/gcc/arm-bcm2708-linux-gnueabi/4.7.1/cc1
/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.7.2/cc1
/opt/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/libexec/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1/cc1
/usr/lib/gcc/i486-linux-gnu/4.6/cc1
/usr/lib/gcc/i486-linux-gnu/4.7/cc1

Running dpkg -S cc1 gives:

libopencc1:i386: /usr/share/doc/libopencc1/changelog.Debian.gz
g++-4.7: /usr/lib/gcc/i486-linux-gnu/4.7/cc1plus
cpp-4.6: /usr/lib/gcc/i486-linux-gnu/4.6/cc1
libopencc1:i386: /usr/share/doc/libopencc1
cpp-4.7: /usr/lib/gcc/i486-linux-gnu/4.7/cc1
libopencc1:i386: /usr/share/doc/libopencc1/copyright
libgcc1:i386: /usr/share/lintian/overrides/libgcc1
ncurses-term: /usr/share/terminfo/x/xterm+pcc1
libgcc1:i386: /usr/share/doc/libgcc1

Any ideas?

9
  • Try to install the build-essential package, same problem was reported on ubuntu take a look here ubuntuforums.org/showthread.php?t=540528
    – vfbsilva
    Dec 20, 2013 at 19:37
  • @vfbsilva Already tried that but no luck (also saw that thread) Dec 20, 2013 at 19:41
  • I might be inclined to try running the make through strace to see what's going on a bit more. strace make.
    – slm
    Dec 20, 2013 at 23:52
  • I tried running with strace but I'm not sure where to look for the issue... Dec 20, 2013 at 23:56
  • What is CCPREFIX? What cross-compiler did you install and where did you install it? Dec 21, 2013 at 1:05

1 Answer 1

4

It seems you are confused between the native compiler and the cross compiler, isn't it ?

The commands you tried to use the native compiler :

gcc -v
gcc -print-prog-name=cc1

You should try

${CCPREFIX}gcc -v
${CCPREFIX}gcc -print-prog-name=cc1

Reading your comments I think you installed the gcc cross-compiler as /home/jorge/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-g‌​nueabi-gcc. If it's the case you should try

make ARCH=arm \
CROSS_COMPILE=/home/jorge/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-g‌​nueabi-

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .