[yocto] gcc reports sysroot is /not/exist!

Chris Simmonds chris at 2net.co.uk
Tue Sep 15 02:20:39 PDT 2015


On 15/09/15 09:58, Paul Eggleton wrote:
> Hi Chris,
> 
> On Tuesday 15 September 2015 09:48:34 Chris Simmonds wrote:
>> I am using Yocto fido (1.8) to generate an SDK for a BeaglBone. I
>> generate the it using the command:
>>
>> $ bitbake core-image-minimal -c populate_sdk
>>
>> Having installed the resulting SDK and sourced
>> /opt/poky/1.8/environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi
>>
>> I find that the sysroot is not set:
>>
>> $ arm-poky-linux-gnueabi-gcc -print-sysroot
>> /not/exist
>>
>> This used to work fine in 1.7 and earlier. It looks like now I have to
>> use $CC in place of arm-poky-linux-gnueabi-gcc, but that messes up many
>> Makefiles which set the compiler with something like
>>
>> CC=$(CROSS_COMPILE)gcc
>>
>> What to do? Why is gcc not configured with a sysroot any more?
> 
> AIUI this had to be done in order to have a per-architecture compiler rather 
> than a per-machine one. I believe if you use make -e then variables set in the 
> environment will take precedence over those set in the makefile, which will 
> allow the CC value set by the SDK's environment setup script to be used.
> 
> (If we haven't documented this somewhere, we definitely ought to.)
> 
> Cheers,
> Paul
> 

Well, that works as far as it goes, but it also overrides my CFLAGS,
LDFLAGS and so on, so I still have to change my Makefiles, of which
there are many.

Also, I am not convinced this is a step in the right direction. I expect
to be able to compile a simple program using:

$ gcc hello.c -o hello

But with this new cross compiler setup, this happens:

$ arm-poky-linux-gnueabi-gcc hello.c -o hello
hello.c:1:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.


Which violates the law of least astonishment.
Chris.



More information about the yocto mailing list