From 50832921ab5eac62350855955d3af3f6f0766bbf Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 31 Jan 2020 20:29:02 +0100 Subject: Architecture-specific C headers on Debian-based OSs now accounted Rencely the building of GCC was allowed on Debian-based systems that have their basic C library in architecture-specific directories, like `/usr/lib/x86_64-linux-gnu'. However, these systems also have their headers in non-standard locations, for example `/usr/include/x86_64-linux-gnu' and this caused a crash on a new Ubuntu system. /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory 27 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. The reason it didn't cause problems on other Ubuntus that we tested before was historic: In the old days, we would ask Ubuntu systems to install multilib features to have GCC. Because they had installed those features, this problem didn't show up! But this wasn't mandatory! With this commit, the `CPATH' environment variable is set (similar to how `LIBRARY_PATH' was set) and this fixed the problem on a clean Debian virtual machine. This bug was reported by Sebastian Luna Valero. --- reproduce/software/bash/configure.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'reproduce/software/bash') diff --git a/reproduce/software/bash/configure.sh b/reproduce/software/bash/configure.sh index a4b3e64..96c4ad0 100755 --- a/reproduce/software/bash/configure.sh +++ b/reproduce/software/bash/configure.sh @@ -872,13 +872,13 @@ if [ x"$$on_mac_os" != xyes ]; then if [ x"$gcctarget" != x ]; then if [ -f /usr/lib/$gcctarget/libc.a ]; then export sys_library_path=/usr/lib/$gcctarget - export sys_cppflags=-I/usr/include/$gcctarget + export sys_cpath=/usr/include/$gcctarget fi fi # For a check: #echo "sys_library_path: $sys_library_path" - #echo "sys_cppflags: $sys_cppflags" + #echo "sys_cpath: $sys_cpath" fi @@ -1176,11 +1176,15 @@ fi -# library_path (ONLY FOR BASIC) -# ----------------------------- +# Paths needed by the host compiler (only for `basic.mk') +# ------------------------------------------------------- # -# During the basic build, we need to include possibly existing special C -# compiler targets (if they exist). +# At the end of the basic build, we need to build GCC. But GCC will build +# in multiple phases, making its own simple compiler in order to build +# itself completely. The intermediate/simple compiler doesn't recognize +# some system specific locations like `/usr/lib/ARCHITECTURE' that some +# operating systems use. We thus need to tell the intermediate compiler +# where its necessary libraries and headers are. export CPPFLAGS="$CPPFLAGS $sys_cppflags" if [ x"$sys_library_path" != x ]; then if [ x"$LIBRARY_PATH" = x ]; then @@ -1188,6 +1192,11 @@ if [ x"$sys_library_path" != x ]; then else export LIBRARY_PATH="$LIBRARY_PATH:$sys_library_path" fi + if [ x"$CPATH" = x ]; then + export LIBRARY_PATH="$sys_cpath" + else + export LIBRARY_PATH="$CPATH:$sys_cpath" + fi fi -- cgit v1.2.1