Skip to contentSkip to conversation

gcc-configure-target: Set native-system-header-dir for target gcc

PATCH In review Richard Purdie 2 participants 3 messages Aug 1, 2012 – Aug 2, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-configure-target: Set native-system-header-dir for target gcc

Without this set, in the case host=target (which it does for on-target gcc), the native header directory is set to the target sysroot with no prefix. This means it would look for sdt.h on the build system instead of in the target headers and this can lead to build failures and is host contamination of the build.

The correct fix is to explicitly set the native header directory to the correct location and then the headers get detected correctly.

---

meta/recipes-devtools/gcc/gcc-configure-target.inc +1 -0
index b2f91b7..f41301f 100644
@@ -3,4 +3,5 @@ require gcc-configure-common.inc
 EXTRA_OECONF_PATHS = " \
     --with-sysroot=/ \
     --with-build-sysroot=${STAGING_DIR_TARGET} \
+    --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
     --with-gxx-include-dir=${includedir}/c++/"
#1 lore raw
Quoted 8 lines · Richard Purdie

Without this set, in the case host=target (which it does for on-target gcc), the native header directory is set to the target sysroot with no prefix. This means it would look for sdt.h on the build system instead of in the target headers and this can lead to build failures and is host contamination of the build.

The correct fix is to explicitly set the native header directory to the correct location and then the headers get detected correctly.

one concern I think is what will happen to gxxinclude dir if this is set. if it will become relative to native headers dir as well I think you have to try it out the compiler on target

Quoted 20 lines

---

meta/recipes-devtools/gcc/gcc-configure-target.inc +1 -0
index b2f91b7..f41301f 100644
@@ -3,4 +3,5 @@ require gcc-configure-common.inc
 EXTRA_OECONF_PATHS = " \
     --with-sysroot=/ \
     --with-build-sysroot=${STAGING_DIR_TARGET} \
+    --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
     --with-gxx-include-dir=${includedir}/c++/"

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 8 lines · Khem Raj
Quoted 6 lines · Richard Purdie

Without this set, in the case host=target (which it does for on-target gcc), the native header directory is set to the target sysroot with no prefix. This means it would look for sdt.h on the build system instead of in the target headers and this can lead to build failures and is host contamination of the build.

Quoted 6 lines
Quoted 2 lines

The correct fix is to explicitly set the native header directory to the correct location and then the headers get detected correctly.

one concern I think is what will happen to gxxinclude dir if this is set. if it will become relative to native headers dir as well I think you have to try it out the compiler on target

I tested the target compiler and couldn't find any problem. I also checked the output of strings on the gcc binaries/libs/headers and couldn't spot anything nasty. I've therefore merged this but we should keep it in mind in case of problems.

Cheers,

Richard