aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJoakim Nohlgård <joakim@nohlgard.se>2022-12-01 09:47:43 +0100
committerChris Packham <judge.packham@gmail.com>2022-12-11 19:52:26 +1300
commit16f611232701d6d370210e6af3a3dac8fafaee5e (patch)
tree07be4be9b98f66ad8d78b56f1ae43fabc7ed1fa4 /scripts
parente04351d666142ed474bfa4b1722ed072b7f1b378 (diff)
downloadcrosstool-ng-16f611232701d6d370210e6af3a3dac8fafaee5e.tar.gz
crosstool-ng-16f611232701d6d370210e6af3a3dac8fafaee5e.tar.bz2
crosstool-ng-16f611232701d6d370210e6af3a3dac8fafaee5e.zip
scripts/gcc: Add extra include dir with -idirafter
Fixes Canadian cross builds failing with missing include file 'stdio.h' when building libstdc++ for a companion libc with system libc set to LIBC_NONE. Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/cc/gcc.sh15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 8cf03cbd..1d7fc065 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -295,7 +295,6 @@ do_gcc_core_backend() {
exec_prefix="${CT_PREFIX_DIR}/${libstdcxx_name}"
fi
extra_config+=( "${CT_CC_SYSROOT_ARG[@]}" )
- extra_config+=( "--with-headers=${header_dir}" )
extra_user_config=( "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" )
log_txt="libstdc++ ${libstdcxx_name} library"
# to inhibit the libiberty and libgcc tricks later on
@@ -554,6 +553,13 @@ do_gcc_core_backend() {
fi
fi
+ # Add an extra system include dir if we have one. This is especially useful
+ # when building libstdc++ with a libc other than the system libc (e.g.
+ # picolibc)
+ if [ -n "${header_dir}" ]; then
+ cflags_for_target="${cflags_for_target} -idirafter ${header_dir}"
+ fi
+
# For non-sysrooted toolchain, GCC doesn't search except at the installation
# prefix; in core stage we use a temporary installation prefix - but
# we may have installed something into the final prefix. This is less than ideal:
@@ -1200,6 +1206,13 @@ do_gcc_backend() {
fi
fi
+ # Add an extra system include dir if we have one. This is especially useful
+ # when building libstdc++ with a libc other than the system libc (e.g.
+ # picolibc)
+ if [ -n "${header_dir}" ]; then
+ cflags_for_target="${cflags_for_target} -idirafter ${header_dir}"
+ fi
+
# Assume '-O2' by default for building target libraries.
cflags_for_target="-g -O2 ${cflags_for_target}"