On Fri, 2020-08-21 at 13:44 -0400, Chris Gorman via blfs-support wrote: > Hello All, > > I am trying to build a sysv BLFS system off of LFS-10.0-rc1 and am > getting an odd error with header files. The compiler is failing > complaining about missing headers that are present on the system. I > have experienced this with two packages, gcc and mesa. > > Attempting to build gcc I get ... > > g++ -std=gnu++98 -c -g -DIN_GCC -fno-exceptions -fno-rtti > -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings > -Wcast-qual -Wno-error=format-diag -Wno-format > -Wmissing-format-attribute -Woverloaded-virtual -pedantic > -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings > -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -I. -Ibuild > -I../../gcc -I../../gcc/build -I../../gcc/../include > -I../../gcc/../libcpp/include \ > -o build/genhooks.o ../../gcc/genhooks.c > In file included from ../../gcc/system.h:266, > from ../../gcc/gengenrtl.c:22: > /usr/include/c++/10.2.0/cstdlib:75:15: fatal error: stdlib.h: No such > file or directory > 75 | #include_next <stdlib.h> > | ^~~~~~~~~~ > compilation terminated. > make[3]: *** [Makefile:2723: build/gengenrtl.o] Error 1 > make[3]: *** Waiting for unfinished jobs.... > In file included from ../../gcc/system.h:266, > from ../../gcc/sort.cc:38: > /usr/include/c++/10.2.0/cstdlib:75:15: fatal error: stdlib.h: No such > file or directory > 75 | #include_next <stdlib.h> > | ^~~~~~~~~~ > compilation terminated. > make[3]: *** [Makefile:2723: build/sort.o] Error 1 > In file included from ../../gcc/system.h:266, > from ../../gcc/genhooks.c:21: > /usr/include/c++/10.2.0/cstdlib:75:15: fatal error: stdlib.h: No such > file or directory > 75 | #include_next <stdlib.h> > | ^~~~~~~~~~ > compilation terminated. > make[3]: *** [Makefile:2723: build/genhooks.o] Error 1 > /bin/sh ../../gcc/../move-if-change tmp-mlib.h multilib.h > echo timestamp > s-mlib > /bin/sh ../../gcc/../move-if-change tmp-optionlist optionlist > echo timestamp > s-options > make[3]: Leaving directory '/sources/gcc/gcc-10.2.0/build/gcc' > make[2]: *** [Makefile:4744: all-stage1-gcc] Error 2 > make[2]: Leaving directory '/sources/gcc/gcc-10.2.0/build' > make[1]: *** [Makefile:25317: stage1-bubble] Error 2 > make[1]: Leaving directory '/sources/gcc/gcc-10.2.0/build' > make: *** [Makefile:1000: all] Error 2 > > And when trying to build mesa I get ... > > [68/2168] Compiling C++ object > src/compiler/libcompiler.a.p/glsl_types.cpp.o > FAILED: src/compiler/libcompiler.a.p/glsl_types.cpp.o > c++ -Isrc/compiler/libcompiler.a.p -Isrc/compiler -I../src/compiler > -Isrc/mapi -I../src/mapi -Isrc/mesa -I../src/mesa -Iinclude > -I../include -Isrc -I../src -I../src/gallium/include > -Isrc/gallium/auxiliary -I../src/gallium/auxiliary > -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 > -Wall > -Winvalid-pch -Wnon-virtual-dtor -std=c++14 -O3 > -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS > '-DPACKAGE_VERSION="20.1.5"' > '-DPACKAGE_BUGREPORT=" > https://gitlab.freedesktop.org/mesa/mesa/-/issues"' > -DUSE_ELF_TLS -DHAVE_ST_VDPAU -DENABLE_ST_OMX_BELLAGIO=0 > -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM > -DGLX_INDIRECT_RENDERING > -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM > -DHAVE_SURFACELESS_PLATFORM -DENABLE_SHADER_CACHE > -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 > -DHAVE___BUILTIN_CLZ > -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT > -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT > -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE > -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN > -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE > -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT > -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT > -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL > -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS > -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_UINT128 -D_GNU_SOURCE > -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM > -DMAJOR_IN_SYSMACROS -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H > -DHAVE_DLFCN_H -DHAVE_EXECINFO_H -DHAVE_SYS_SHM_H -DHAVE_CET_H > -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE > -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R > -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_POSIX_MEMALIGN > -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR > -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_ZSTD -DHAVE_PTHREAD > -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DLLVM_AVAILABLE > '-DMESA_LLVM_VERSION_STRING="10.0.1"' -DHAVE_WAYLAND_PLATFORM > -DWL_HIDE_DEPRECATED -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS > -Werror=return-type -Werror=empty-body -Wno-non-virtual-dtor > -Wno-missing-field-initializers -Wno-format-truncation -fno-math- > errno > -fno-trapping-math -flifetime-dse=1 -Werror=format -Wformat-security > -fPIC -fvisibility=hidden -Werror=pointer-arith -Werror=vla -MD -MQ > src/compiler/libcompiler.a.p/glsl_types.cpp.o -MF > src/compiler/libcompiler.a.p/glsl_types.cpp.o.d -o > src/compiler/libcompiler.a.p/glsl_types.cpp.o -c > ../src/compiler/glsl_types.cpp > In file included from ../include/c99_math.h:194, > from ../src/util/u_math.h:42, > from ../src/mesa/main/macros.h:35, > from ../src/compiler/glsl_types.cpp:25: > /usr/include/c++/10.2.0/cmath:45:15: fatal error: math.h: No such > file > or directory > 45 | #include_next <math.h> > | ^~~~~~~~ > compilation terminated. > [69/2168] Generating nir_builder_opcodes.h with a meson_exe.py custom > command > [70/2168] Generating marshal_generated2.c with a meson_exe.py custom > command > [71/2168] Generating marshal_generated4.c with a meson_exe.py custom > command > [72/2168] Generating es1_glapi_mapi_tmp.h with a meson_exe.py custom > command > [73/2168] Generating nir_constant_expressions.c with a meson_exe.py > custom command > [74/2168] Generating indirect.h with a meson_exe.py custom command > [75/2168] Generating es2_glapi_mapi_tmp.h with a meson_exe.py custom > command > [76/2168] Generating indirect_init.c with a meson_exe.py custom > command > [77/2168] Generating indirect_size.h with a meson_exe.py custom > command > [78/2168] Generating indirect_size.c with a meson_exe.py custom > command > [79/2168] Generating shared_glapi_mapi_tmp.h with a meson_exe.py > custom command > [80/2168] Generating format_srgb with a meson_exe.py custom command > [81/2168] Compiling C object > src/util/format/libmesa_format.a.p/meson- > generated_.._u_format_table.c.o > ninja: build stopped: subcommand failed. > > Both stdlib.h and math.h are on the system. > > chris [ /mnt/build_dir ]$ find ./usr/include -name "math.h" > ./usr/include/c++/10.2.0/tr1/math.h > ./usr/include/c++/10.2.0/math.h > ./usr/include/math.h > > chris [ /mnt/build_dir ]$ find ./usr/include -name "stdlib.h" > ./usr/include/c++/10.2.0/tr1/stdlib.h > ./usr/include/c++/10.2.0/stdlib.h > ./usr/include/stdlib.h > ./usr/include/bits/stdlib.h > > I tried a google search and found > https://blfs-dev.linuxfromscratch.narkive.com/so2k0krL/math-h-no-such-file-or-directory-from-gcc > > After reading the thread I tried to run > > /usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/install-tools/mkheaders > > as root but I still get the errors when trying to build. > > Hoping someone has experienced this and can help. Thanks in advance.
There have been several reports of this in the past without clear solution. The problem seems to lie in the order of include directories. You can see that order using gcc -v. Exactly: echo main'(){}' | g++ -v -xc++ - should return: [...] #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0 /usr/lib/gcc/x86_64-pc-linux- gnu/10.2.0/../../../../include/c++/10.2.0/x86_64-pc-linux-gnu /usr/lib/gcc/x86_64-pc-linux- gnu/10.2.0/../../../../include/c++/10.2.0/backward /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include-fixed /usr/include [...] If the order is the same as above for you, then I am at loss. Pierre -- http://lists.linuxfromscratch.org/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page