I am cross compiling the Raspbian kernel since it will take about 12 hours for the Pi to do (Raspberry Pi 1).

I have the build tools for ARM and the kernel in two separate folders in /home/gray/Desktop/tmp/

I am following this guide: http://elinux.org/Raspberry_Pi_Kernel_Compilation

My issue is that when I go to compile, it can't find arm-linux-gnueabihf-gcc-4.8.3 which is clearly in the folder I linked when I did export CCPREFIX. Here is what I did:

gray@Rava-Xubuntu:~/Desktop/tmp/linux$ export CCPREFIX=/home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-

And it returns when I try to build:

gray@Rava-Xubuntu:~/Desktop/tmp/linux$ make ARCH=arm CROSS_COMPILE=${CCPREFIX}
/home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: 1: /home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: arm-linux-gnueabihf-gcc-4.8.3: not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
/home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: 1: /home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: arm-linux-gnueabihf-gcc-4.8.3: not found
Kbuild:43: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 127
Makefile:990: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

Even though the file is clearly in there:

Even though the file is clearly in there


  • Try adding /home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin to PATH: export PATH=/home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH – user140866 Dec 2 '15 at 4:09
  • Same result. :( – Gray Dec 2 '15 at 4:36
  • This is strange. Either there is a typo somewhere in this long path, or you'd hit a bug. For me alien kernel compilation always worked as make ARCH=arch CROSS_COMPILE=/path/to/toolchain/bin/toolchain-triplet-. Double check everything, and if still no go, try strace -f -eexecve -v -s150 -o log make ... and then post result (file log) on pastebin.com. – user140866 Dec 2 '15 at 7:03
  • Is the toolchain complete? You seem not to be able to compile an asm file, not a C file. – Rui F Ribeiro Dec 2 '15 at 7:20
  • I had to truncate it a bit @siblynx pastebin.com/ZdGfP3Qg That is the last bit of the log. – Gray Dec 2 '15 at 8:53

I did not able to find where arm-linux-gnueabihf-gcc-4.8.3 is failing from your provided http://pastebin.com/ZdGfP3Qg, but your PATH environment variable contains weird characters:

PATH=/home/gray/Desktop/tmp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-ras\342\200\214\342\200\213pbian/bin:/home/gray/bin:/usr/local/sbin:/usr/local/bin:/usr/sbi" ...

Those \342\200\214\342\200\213 in raspbian part should not be there.

Recheck your scripts and set PATH appropriately.

Your CROSS_COMPILE however appears to be intact. Most probably gcc tries to run things from PATH or you have a broken toolchain/dangling symlink somewhere.

Use this strace to debug deeply:

strace -f -v -s150 -o log -eexecve,stat,stat64 (make command) and then do fgrep ENOENT log. Then filter out nonexistent items from your PATH and try to locate and fix remaining items to be on place.

|improve this answer|||||
  • Thanks for the help. I was able to dig through the log and see it was looking for files in a lot of different places. I posted my solution. – Gray Dec 2 '15 at 18:09
  • Nice. So next time using distro provided items is more helpful than messing with own ones. Except the cases when you need your own setup. But in that cases you're already know what to do :-) – user140866 Dec 2 '15 at 18:21

So I figured it out.

I just grabbed the crossbuild version of gcc (I think that is what it is)

sudo apt-get install crossbuild-essential-armhf

And then my new path is:

export CCPREFIX=/usr/bin/arm-linux-gnueabihf-

And the build works perfectly!

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.