Bug 7342

Summary: Installing a toolchain to a non-standard directory results in cross gcc with broken include path
Product: [Runtime] Installation Reporter: Martin Kaiser <yocto>
Component: InstallationAssignee: Aníbal Limón <anibal.limon>
Status: VERIFIED NOTABUG QA Contact: Alexandru Georgescu <alexandru.c.georgescu>
Severity: normal    
Priority: Medium+ CC: alexandru.c.georgescu, anibal.limon, kevin.tian, sgw
Version: 1.7.1   
Target Milestone: 1.8 M4   
Hardware: x86   
OS: arm   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Martin Kaiser 2015-02-20 17:40:29 UTC
I built a cross-toolchain for armvte and eventually got a
poky-glibc-x86_64-core-image-minimal-armv5te-toolchain-1.7.1.sh

that I can use for installing the toolchain. The base dir defaults to /opt/poky/1.7.1/

If I choose a different dir (e.g. /usr/local/poky-1.7.1/), the environment setup script adds a sysroot setting. However, the cross gcc has hard-coded default include paths pointing to the (non-existent) dir /opt/poky/1.7.1/...


`$CC -print-prog-name=cc1plus` --sysroot=/usr/local/poky-1.7.1/sysroots/armv5te-poky-linux-gnueabi -v

ignoring nonexistent directory "/opt/poky/1.7.1/sysroots/armv5te-poky-linux-gnueabi/usr/include/c++/4.9.1"
ignoring nonexistent directory "/opt/poky/1.7.1/sysroots/armv5te-poky-linux-gnueabi/usr/include/c++/4.9.1/arm-poky-linux-gnueabi"
ignoring nonexistent directory "/opt/poky/1.7.1/sysroots/armv5te-poky-linux-gnueabi/usr/include/c++/4.9.1/backward"
...

Therefore, I get compile errors on programs that #include <sys/types.h>
Comment 1 Aníbal Limón 2015-02-26 23:35:57 UTC
The problem is about cc1plus that don't understand --sysroot option, cc1plus use -isysroot example,

`$CC -print-prog-name=cc1plus` -isysroot /usr/local/poky-1.7.1/sysroots/armv5te-poky-linux-gnueabi -v

But if you want to use the preprocessor i suggest you to use the $CPP enviroment variable that is set for sdk envscript.
Comment 2 Alexandru Georgescu 2015-03-26 06:33:30 UTC
(In reply to comment #1)
> The problem is about cc1plus that don't understand --sysroot option, cc1plus
> use -isysroot example,
> 
> `$CC -print-prog-name=cc1plus` -isysroot
> /usr/local/poky-1.7.1/sysroots/armv5te-poky-linux-gnueabi -v
> 
> But if you want to use the preprocessor i suggest you to use the $CPP
> enviroment variable that is set for sdk envscript.

Verified as per Anibal's comments.