makefilecross-compilingu-boottoolchain

U-boot cross compilation: why isn't make using chosen toolchain?


I have an odd problem, that I have noticed. For the purpose of building ancient uboot (2012.10), I am using an external toolchain (uClibc-ng). I am building ARM target. Here's the command that I am using:

PATH='/home/build/src/build/x-tools/armv7a-g4.9.2-lnx3.2.69-uClibc-ng-1.0.22/install/arm-onie-linux-uclibcgnueabi/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' make CROSS_COMPILE=arm-onie-linux-uclibcgnueabi-

The build commences, but I have accidentally noticed, that the external toolchain is not being used. I have verified that by adding few lines to u-boot Makefile:

+GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g')
+ifeq "$(GCCVERSION)" "7.5.0"
+$(error *** IT DOES NOT SEEM LIKE YOU ARE USING CROSS-COMPILER TOOLCHAIN! ***)
+endif

It is odd, as analyzing logs it seems obvious, that 'CROSS_COMPILE=' prefix is not being used. I have tried exporting both PATH and CROSS_COMPILE to environment, but it didn't work either.

I am building it in Docker container, on Ubuntu-18.

What am I missing ?


Solution

  • The question was well.. not very smart. Instead of: (..) +GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') (..)

    I should have tested against: +GCCVERSION = $(shell $(CC) --version | (..))

    Basically I was calling GCC instead of $CC that would be set to actual cross compiler.