Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: fix crash on CC without libc support #187777

Merged
merged 1 commit into from
Aug 21, 2022

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Aug 21, 2022

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 #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.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

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.
@trofi
Copy link
Contributor Author

trofi commented Aug 21, 2022

Tested successfully on pkgsLLVM.llvmPackages.compiler-rt (x86_64-linux).

Copy link
Contributor

@stephank stephank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bleh, shouldn’t have made that assumption. Thanks for fixing it, lgtm!

@trofi trofi merged commit d599919 into NixOS:staging Aug 21, 2022
@trofi trofi deleted the cmake-fix-non-libc-case branch August 21, 2022 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants