From 981b640aec4f5ea0cd831c1534c441fdc554e8b6 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 8 Nov 2023 22:53:22 -0800 Subject: [PATCH] cc-wrapper: drop no-longer-necessary hack The commit prior to this one, "gcc: fix c++ headers when same triplet cross compiling" causes gcc's c++ headers to be in the same outpath subdirectory regardless of whether the gcc build is a host==target or host!=target compiler. As a result of that change, the hack in cc-wrapper which adapted to the different paths is no longer needed. And, in fact, it must be removed, since if it is left in place builds such as pkgsCross.aarch64-multiplatform.firefox will fail as shown below. ``` firefox-unwrapped> 0:02.01(B checking the host C compiler works... yes(B(B firefox-unwrapped> 0:02.01(B checking for the host C++ compiler... /nix/store/1asqji9djmdlapzs70q7jw2j308ry7cn-clang-wrapper-16.0.6/bin/c++(B(B firefox-unwrapped> 0:02.14(B checking whether the host C++ compiler can be used... yes(B(B firefox-unwrapped> 0:02.14(B checking the host C++ compiler version... 16.0.6(B(B firefox-unwrapped> 0:02.21(B checking the host C++ compiler works... yes(B(B firefox-unwrapped> 0:02.40(B checking for target linker... lld(B(B firefox-unwrapped> 0:02.51(B checking for host linker... lld(B(B firefox-unwrapped> 0:02.60(B checking for 64-bit OS... yes(B(B firefox-unwrapped> 0:02.67(B checking for new enough STL headers from libstdc++...(B(B firefox-unwrapped> 0:02.67(B DEBUG: (B(B firefox-unwrapped> 0:02.67(B DEBUG: | #if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)(B(B firefox-unwrapped> 0:02.67(B DEBUG: | # error libstdc++ not new enough(B(B firefox-unwrapped> 0:02.67(B DEBUG: | #endif(B(B firefox-unwrapped> 0:02.67(B DEBUG: | #if defined(_GLIBCXX_RELEASE)(B(B firefox-unwrapped> 0:02.67(B DEBUG: | # if _GLIBCXX_RELEASE < 8(B(B firefox-unwrapped> 0:02.67(B DEBUG: | # error libstdc++ not new enough(B(B firefox-unwrapped> 0:02.67(B DEBUG: | # else(B(B firefox-unwrapped> 0:02.67(B DEBUG: | (void) 0(B(B firefox-unwrapped> 0:02.67(B DEBUG: | # endif(B(B firefox-unwrapped> 0:02.67(B DEBUG: | #endif(B(B firefox-unwrapped> 0:02.67(B DEBUG: | ;(B(B firefox-unwrapped> 0:02.67(B DEBUG: | return 0;(B(B firefox-unwrapped> 0:02.67(B DEBUG: | }(B(B firefox-unwrapped> 0:02.67(B DEBUG: Executing: `/nix/store/7v4bi4q334yircaznwm353h1l5i7k98f-aarch64-unknown-linux-gnu-clang-wrapper-16.0.6/bin/aarch64-unknown-linux-gnu-clang++ /build/conftest.qvbo58dv.cpp -c`(B(B firefox-unwrapped> 0:02.67(B DEBUG: The command returned non-zero exit status 1.(B(B firefox-unwrapped> 0:02.67(B DEBUG: Its error output was:(B(B firefox-unwrapped> 0:02.67(B DEBUG: | /build/conftest.qvbo58dv.cpp:1:10: fatal error: 'cstddef' file not found(B(B firefox-unwrapped> 0:02.67(B DEBUG: | #include (B(B firefox-unwrapped> 0:02.67(B DEBUG: | ^~~~~~~~~(B(B firefox-unwrapped> 0:02.67(B DEBUG: | 1 error generated.(B(B firefox-unwrapped> 0:02.67(B ERROR: The libstdc++ in use is not new enough. Please run ./mach bootstrap to update your compiler, or update your system libstdc++ installation.(B(B firefox-unwrapped> *** Fix above errors and then restart with "./mach build" error: build of '/nix/store/5in7xkji5hzqkl14ygwq3vxnni54lykk-firefox-unwrapped-aarch64-unknown-linux-gnu-119.0.1.drv' on 'ssh://root@192.168.22.103' failed: builder for '/nix/store/5in7xkji5hzqkl14ygwq3vxnni54lykk-firefox-unwrapped-aarch64-unknown-linux-gnu-119.0.1.drv' failed with exit code 1 error: builder for '/nix/store/5in7xkji5hzqkl14ygwq3vxnni54lykk-firefox-unwrapped-aarch64-unknown-linux-gnu-119.0.1.drv' failed with exit code 1; ``` --- pkgs/build-support/cc-wrapper/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 8ac11436c5f7b..3cb5a10b5c3b6 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -518,10 +518,10 @@ stdenv.mkDerivation { # additional -isystem flags will confuse gfortran (see # https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903) + optionalString (libcxx == null && isClang && (useGccForLibs && gccForLibs.langCC or false)) '' - for dir in ${gccForLibs}${lib.optionalString (hostPlatform != targetPlatform) "/${targetPlatform.config}"}/include/c++/*; do + for dir in ${gccForLibs}/include/c++/*; do echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags done - for dir in ${gccForLibs}${lib.optionalString (hostPlatform != targetPlatform) "/${targetPlatform.config}"}/include/c++/*/${targetPlatform.config}; do + for dir in ${gccForLibs}/include/c++/*/${targetPlatform.config}; do echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags done ''