[yocto] problem of toolchain install directrory

Liviu Gheorghisan liviu.gheorghisan at enea.com
Wed Dec 17 01:46:31 PST 2014


Hello Neil,

Your problem is that the toolchain is installed with the location of the 
sysroot hardcoded as the default installation path for the tool-chain.
You can see this location with:
$ arm-poky-linux-gnueabi-gcc --print-sysroot // or whatever 
cross-compiler you built

However, after you source the environment script for the toolchain:

$ source environment-setup-armv7a-vfp-neon-poky-linux-gnueabi

the environment variables related to the toolchain will be updated 
accordingly, taking care of this problem.

So, use $CC instead of directly calling the gcc cross compiler 
arm-poky-linux-gnueabi-gcc (or whatever the platform you're building for).

Check the difference with this:
$ echo $CC
arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork 
-mfloat-abi=softfp -mfpu=neon 
--sysroot=/home/livghe/work/ab/sdk/sysroots/armv7a-vfp-neon-poky-linux-gnueabi

$ $CC --print-sysroot // uses the correct sysroot
/home/livghe/work/ab/sdk/sysroots/armv7a-vfp-neon-poky-linux-gnueabi

$ $ arm-poky-linux-gnueabi-gcc --print-sysroot // uses the sysroot from 
the default instalation path, where it's not present.
/opt/poky/4.0/sysroots/armv7a-vfp-neon-poky-linux-gnueabi

So, you should always use the env variables ($CC, $AR, $LDFLAGS, etc) 
after sourcing the environment script from the toolchain instalation 
path, and not the toolchain executables directly, because the 
environment variables add some useful flags, not only related to the 
sysroot, but also to the type of CPU, etc.

- Liviu


On 12/17/2014 11:30 AM, Neil.Wu at Emerson.com wrote:
>
> *Hello ,all*
>
> I build the toolchain via  bitbake core-image-minimal –c populate_sdk. 
> Then I install the toolchain.
>
> If I install the toolchain in default directory(/default: 
> /opt/poky/1.7.1/), everything is ok.
>
> But,   if I not install in the default directory, it will appears the 
> problem that can’t find the system header files.
>
> Example: stdio.h
>
> Why is this ? Whether I need to do some other operation.  If you know 
> please help me ! Thank you very much.
>
> Best wishes
>
> Neil
>
>
>

-- 
Liviu Gheorghisan
Software Engineer

http://www.enea.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20141217/5007ef69/attachment.html>


More information about the yocto mailing list