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

llvmPackages_15: init at 15.0.7 #194634

Merged
merged 30 commits into from
Jan 28, 2023
Merged

llvmPackages_15: init at 15.0.7 #194634

merged 30 commits into from
Jan 28, 2023

Conversation

rrbutani
Copy link
Contributor

@rrbutani rrbutani commented Oct 5, 2022

Note
Further work is being tracked in #213033


Description of changes

The commit messages in this PR have more details but at a high level this PR contains a few different kinds of changes:

  • introduces llvmPackages_15
  • switching to using clang from this package set to bootstrap libcxx, sidestepping some of the issues we've seen with older LLVM package sets
  • switches to ninja where possible
  • re-enables Polly by default
  • enables the LLVM tests on macOS (x86_64 and aarch64)
  • miscellaneous fixes (lldb, manpages) and updates (LLVM license, dropping some flags we don't need anymore)
  • mostly mechanical changes to make it easier to override the monorepo source used in the package set (the last two commits)

TODOs:

Checks:

  • llvmPackages_15.*
  • passthru tests
  • test cross / use as a cross compiler with this script
    • only focusing on this passing eval successfully for now
      • i.e.:
        • nix path-info --file ./test.nix --derivation
        • nix path-info --file ./test.nix --derivation --arg systems '[ "aarch64-darwin" "x86_64-darwin" ]' --arg testStdenvPackages '[]'
    • and checking that the following don't regress:
      • pkgsCross.x86_64-freebsd.boost (with llvmPackages = llvmPackages_15)
        • i.e. nix build --expr '(import ./. { system = "x86_64-linux"; overlays = [(f: p: { llvmPackages = f.llvmPackages_15; })]; }).pkgsCross.x86_64-freebsd.boost'
        • this is currently broken in libcxx
  • rdeps with nixpkgs-review
    • not applicable since we're not bumping llvmPackages_latest

Closes #191132.

Things done
  • Built on platform(s)
    • x86_64-linux
    • i686-linux
    • aarch64-linux
    • armv7l-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.

@rrbutani
Copy link
Contributor Author

rrbutani commented Oct 7, 2022

With ab9d3df, libcxx-abi (and the rest of llvmPackages_15) builds fine on aarch64-linux as well as x86_64-linux. Darwin is now hitting an unrelated issue in compiler-rt; I'll tackle that next.

After that:

@rrbutani rrbutani mentioned this pull request Oct 7, 2022
13 tasks
@rrbutani
Copy link
Contributor Author

rrbutani commented Oct 7, 2022

Fixed one compiler-rt build issue, hit another one.

compiler-rt's build now attempts to detect whether the ld used automatically does codesigning, based on version. Our cctools ld is too old for this but postLinkSignHook handles codesigning for us, regardless.

Unfortunately there doesn't seem to be a way to communicate this to the compiler-rt build machinery. In the interest of avoiding making another patch, I tried to add sigtool to the derivation and just let the compiler-rt build sign some dylibs twice but unfortunately compiler-rt's build uses --sign instead of -s which the sigtool in nixpkgs has not been updated to support.

I opened a PR for this (#194994) but given that sigtool has many transitive deps and that that PR is likely to trigger many rebuilds I think it's probably faster to just add a compiler-rt patch.

@rrbutani
Copy link
Contributor Author

rrbutani commented Oct 7, 2022

With 974ea1c this now builds on aarch64-darwin.

Testing x86_64-darwin now; hopefully it Just Works 🤞.


Update: lldb fails to build on x86_64-darwin; it's failing on #include <bsm/audit_session.h> and CPU_SUBTYPE_ARM64E not being present in mach/machine.h 😕

<bsm/audit_session.h>

This isn't an issue on aarch64-darwin because we use a newer SDK there:

apple_sdk = if stdenv.hostPlatform.isAarch64 then apple_sdk_11_0 else apple_sdk_10_12;

This is the change in upstream causing the issue: llvm/llvm-project@b945b62

lldb appears to only use AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS from audit_session.h which, worst case, would be easy to stub or patch out.

Fortunately, this header is available in the macOS 10.12 SDK (i.e. nixpkgs.darwin.apple_sdk.sdk.dev). Is it okay for me to depend on this header? This was the only precedent in nixpkgs I could find:

install -Dm444 "${lib.getDev apple_sdk.sdk}"/include/libproc.h "$out"/include/libproc.h

CPU_SUBTYPE_ARM64E

For CPU_SUBTYPE_ARM64E I am not sure why we're just hitting this issue now; it appears to have been added in LLVM 13? llvm/llvm-project@479b672

Edit: oh, of course; lldb is marked as broken for LLVM 13 and 14:

broken = stdenv.isDarwin; # error: use of undeclared identifier 'CPU_SUBTYPE_ARM64E'

It's not marked as broken in llvmPackages_git but I'm willing to bet that has the same issue.


Fixed in 040efed and opened #195013 to fix lldb 14 and lldb 13 on macOS x86_64.

RaitoBezarius pushed a commit that referenced this pull request Mar 26, 2023
None of the patches required any touch-up; the only change of note is:
  - due to changes in the libc++/libc++abi build
    (https://reviews.llvm.org/D120719 and https://reviews.llvm.org/D131037)
    we have to add an extra build option to the libc++ header only
    build that sidesteps bits of the libc++ build config that assume
    libc++-abi is present in the build:
    https://github.com/llvm/llvm-project/blob/4f827318e3e8ccab4ff131e06234caa827e91e4e/libcxx/src/CMakeLists.txt#L255-L256

Rather than maintaining a precise set of build options that let us dodge
referencing libc++-abi variables in the libc++ header only build, we set
`LIBCXX_CXX_ABI` to `none`, as suggested by @lovesegfault.

More discussion about this here: #194634 (comment)

Co-authored-by: Bernardo Meurer <[email protected]>
RaitoBezarius pushed a commit that referenced this pull request Mar 26, 2023
See the comments here for context: #194634 (comment)

Co-authored-by: Weijia Wang <[email protected]>
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 3, 2023
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 3, 2023
…as overridable args

backport of d231d18 from NixOS#194634
(llvmPackages_15)
RaitoBezarius pushed a commit that referenced this pull request Apr 5, 2023
Port of bc4dbee ("llvmPackages_15:
updates for LLVM 15").

None of the patches required any touch-up; the only change of note is:
  - due to changes in the libc++/libc++abi build
    (https://reviews.llvm.org/D120719 and https://reviews.llvm.org/D131037)
    we have to add an extra build option to the libc++ header only
    build that sidesteps bits of the libc++ build config that assume
    libc++-abi is present in the build:
    https://github.com/llvm/llvm-project/blob/4f827318e3e8ccab4ff131e06234caa827e91e4e/libcxx/src/CMakeLists.txt#L255-L256

Rather than maintaining a precise set of build options that let us dodge
referencing libc++-abi variables in the libc++ header only build, we set
`LIBCXX_CXX_ABI` to `none`, as suggested by @lovesegfault.

More discussion about this here: #194634 (comment)

Co-authored-by: Bernardo Meurer <[email protected]>
RaitoBezarius pushed a commit that referenced this pull request Apr 5, 2023
Port of 4fabcf4 ("llvmPackages_15:
apply #211230 to llvmPackages_15").

See the comments here for context: #194634 (comment)

Co-authored-by: Weijia Wang <[email protected]>
RaitoBezarius pushed a commit that referenced this pull request Apr 5, 2023
Partial port of 00839fe
("llvmPackages_15.compiler-rt: fixes for Darwin")

see: #194634 (comment)
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 5, 2023
Partial port of 00839fe
("llvmPackages_15.compiler-rt: fixes for Darwin")

see: NixOS#194634 (comment)
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 5, 2023
Port of bc4dbee ("llvmPackages_15:
updates for LLVM 15").

None of the patches required any touch-up; the only change of note is:
  - due to changes in the libc++/libc++abi build
    (https://reviews.llvm.org/D120719 and https://reviews.llvm.org/D131037)
    we have to add an extra build option to the libc++ header only
    build that sidesteps bits of the libc++ build config that assume
    libc++-abi is present in the build:
    https://github.com/llvm/llvm-project/blob/4f827318e3e8ccab4ff131e06234caa827e91e4e/libcxx/src/CMakeLists.txt#L255-L256

Rather than maintaining a precise set of build options that let us dodge
referencing libc++-abi variables in the libc++ header only build, we set
`LIBCXX_CXX_ABI` to `none`, as suggested by @lovesegfault.

More discussion about this here: NixOS#194634 (comment)

Co-authored-by: Bernardo Meurer <[email protected]>
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 5, 2023
Port of 4fabcf4 ("llvmPackages_15:
apply NixOS#211230 to llvmPackages_15").

See the comments here for context: NixOS#194634 (comment)

Co-authored-by: Weijia Wang <[email protected]>
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 5, 2023
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 5, 2023
…as overridable args

backport of d231d18 from NixOS#194634
(llvmPackages_15)
alyssais pushed a commit that referenced this pull request Apr 17, 2023
this is a backport of 8afa321
from #194634 (llvmPackages_15)
alyssais pushed a commit that referenced this pull request Apr 17, 2023
…as overridable args

backport of d231d18 from #194634
(llvmPackages_15)
@Artturin Artturin mentioned this pull request Nov 25, 2023
13 tasks
@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

request: add llvmPackages_15