Skip to content

Commit

Permalink
cmake: fix crash on CC without libc support
Browse files Browse the repository at this point in the history
Without this change pkgsLLVM fails to build any packages
as compiler-rt fails early in cmake:

    CMake Error at ...-cmake-3.24.0/share/cmake-3.24/Modules/Platform/UnixPaths.cmake:53 (file):
      file STRINGS file
      "...-x86_64-unknown-linux-gnu-clang-wrapper-11.1.0/nix-support/orig-libc-dev"
      cannot be read.

It's a regression caused by 871cf9f "cmake: detect libc location
at runtime NixOS#181431" where we started using `orig-libc-dev` as a libc pointer.

During pkgsLLVM pootstrap first compiler has no libc support yet.

The change skips runtime detection if there are no libc signs.
  • Loading branch information
trofi committed Aug 21, 2022
1 parent 1622736 commit da0a5e5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index b9381c3d7d..5e944640b5 100644
# CMake install location
"${_CMAKE_INSTALL_DIR}"
)
@@ -47,48 +44,46 @@ endif()
@@ -47,48 +44,48 @@ endif()

# Non "standard" but common install prefixes
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
Expand All @@ -22,7 +22,9 @@ index b9381c3d7d..5e944640b5 100644
)

# List common include file locations not under the common prefixes.
+if(IS_DIRECTORY $ENV{NIX_CC})
+if(IS_DIRECTORY $ENV{NIX_CC}
+ AND EXISTS $ENV{NIX_CC}/nix-support/orig-libc
+ AND EXISTS $ENV{NIX_CC}/nix-support/orig-libc-dev)
+ file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc" _nix_cmake_libc)
+ file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc-dev" _nix_cmake_libc_dev)
+else()
Expand Down

0 comments on commit da0a5e5

Please sign in to comment.