Message ID | 20240614121218.63375-1-syq@gcc.gnu.org |
---|---|
State | New |
Headers | show |
Series | Build/Cross: Look for target headers from include if sys-include doesn't exist | expand |
YunQiang Su <syq@gcc.gnu.org> 于2024年6月14日周五 20:12写道: > > PR 115416 > > When we build a cross toolchain, while without --with-sysroot, > target headers are expected in > ${test_exec_prefix}/${target_noncanonical}/sys-include > while it is true only with --with-headers option is used. In other > cases, the path should be > ${test_exec_prefix}/${target_noncanonical}/include > such as Debian's cross toolchain. > > Debian's cross toolchain has directory structures like: > /usr/<triple>/lib > /include > /bin/<binutils-exe> > > For this case, we cannot use "--prefix=/usr --with-sysroot=/", as > gcc/configure will use headers of build, aka in /usr/include to detect > features. And fixinclude also uses the headers of build. > > Let's use the `include` if `sys-include` doesn't exist. > > For Makefile.in, the compare @includedir@ and $(prefix)/include is not > correct, as the --includedir option is used to set where the headers > should be installed. > > gcc: > PR 115415. > configure.ac: Set target_header_dir and CROSS_SYSTEM_HEADER_DIR > to ${test_exec_prefix}/${target_noncanonical}/include when cross > and without --with-sysroot and without --with-headers. > configure: Regenerate. > Makefile.in: Set CROSS_SYSTEM_HEADER_DIR as configure, and don't > compare @includedir@ and $(prefix)/include. > --- > gcc/Makefile.in | 6 +----- > gcc/configure | 8 ++++++-- > gcc/configure.ac | 4 ++++ > 3 files changed, 11 insertions(+), 7 deletions(-) > Gently ping.
Ping again.
YunQiang Su <syq@gcc.gnu.org> 于2024年7月5日周五 16:14写道: > > Ping again. Ping.
YunQiang Su <syq@gcc.gnu.org> writes: > YunQiang Su <syq@gcc.gnu.org> 于2024年7月5日周五 16:14写道: >> >> Ping again. > > Ping. I can test it next week but I can't approve it. Remind me then?
diff --git a/gcc/Makefile.in b/gcc/Makefile.in index f5adb647d3f..349f988dc08 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -560,11 +560,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h # Default native SYSTEM_HEADER_DIR, to be overridden by targets. NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. -ifeq (@includedir@,$(prefix)/include) - CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ -else - CROSS_SYSTEM_HEADER_DIR = @includedir@ -endif +CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ # autoconf sets SYSTEM_HEADER_DIR to one of the above. # Purge it of unnecessary internal relative paths diff --git a/gcc/configure b/gcc/configure index aaf5899cc03..d11e97d1758 100755 --- a/gcc/configure +++ b/gcc/configure @@ -15124,6 +15124,10 @@ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x || target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = x; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" + if ! test -d ${target_header_dir};then + target_header_dir="${test_exec_prefix}/${target_noncanonical}/include" + fi + CROSS_SYSTEM_HEADER_DIR=${target_header_dir} elif test "x$with_sysroot" = xyes; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else @@ -21410,7 +21414,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21413 "configure" +#line 21417 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21516,7 +21520,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21519 "configure" +#line 21523 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index f8d67efeb98..54e6776747e 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2512,6 +2512,10 @@ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x || target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = x; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" + if test -d ${target_header_dir};then + target_header_dir="${test_exec_prefix}/${target_noncanonical}/include" + fi + CROSS_SYSTEM_HEADER_DIR=${target_header_dir} elif test "x$with_sysroot" = xyes; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else