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.libc: init at 20.0.0-unstable-2024-12-08 #363449

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

RossComputerGuy
Copy link
Member

Things done

Adds LLVM libc, we've got the overlay building but full is still kinda borked. We're only going to support from >= LLVM 20 because it requires a lot of patching in previous versions. We're hoping the inclusion of LLVM libc at the point it is right now could help further its development and we can figure out how to package it better early on.

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label Dec 9, 2024
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 9, 2024
@alyssais
Copy link
Member

The non-full variant doesn't seem to be used?

@RossComputerGuy
Copy link
Member Author

As of this time, the overlay build isn't a dependency for anything.

@alyssais
Copy link
Member

What is "the overlay build"? I don't see it explained anywhere here.

@RossComputerGuy
Copy link
Member Author

The overlay build is the non full build of LLVM libc.

@alyssais
Copy link
Member

What's the point of it?

@RossComputerGuy
Copy link
Member Author

I asked the LLVM libc team on their Discord server:

Statically link a few libc dependencies, it's mostly a concession to make it usable until we can provide a complete C library

@alyssais
Copy link
Member

What does "kinda borked" mean?

@RossComputerGuy
Copy link
Member Author

The full build has some problems still needing to be worked out. There's some odd C++ errors preventing compiling. Overlay builds work.

@alyssais
Copy link
Member

So then why add two attributes, one that works and one that doesn't? Why not just one libc attribute that builds as much as we can?

Is this actually useful for anything yet? If not, maybe we should just wait until we can at least build it properly.

@RossComputerGuy
Copy link
Member Author

I was recommended to have both as an option since it'll allow for flexibility if things are broken. I'm going to be working on fixing the full build soon, just haven't gotten time. I've got some PR's merged upstream and some other might've flown under my radar so it could be working.

@alyssais
Copy link
Member

For flexibility, wouldn't a single attribute with an option we could flip be better? Otherwise, we'd have to change everything that referred to the attribute all at once if we wanted to go from full to overlay.

@RossComputerGuy
Copy link
Member Author

My thinking was to probably have 3, two are the actual builds and one is an alias. I think other parts of LLVM does this already in nixpkgs.

@alyssais
Copy link
Member

But if the full build is working, why would we ever need the alias? Why does it need an attribute too?

@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 18, 2024
@RossComputerGuy
Copy link
Member Author

We already have to set a boolean anyways for full builds. The dependencies are different too. Providing both makes it easier to test if both work and for people to experiment with.

@alyssais
Copy link
Member

If full is building, why would I want to test with overlay?

@RossComputerGuy
Copy link
Member Author

I was meaning people who write software using nix could try it out. I know some people who would want to try it out.

@alyssais
Copy link
Member

Yes, but is there a reason they'd specifically want to test out the non-full version, even if full is available and building?

@github-actions github-actions bot added the 6.topic: lib The Nixpkgs function library label Dec 25, 2024
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 25, 2024
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1 labels Dec 25, 2024
@@ -91,7 +91,7 @@ let
&& final.parsed.kernel == platform.parsed.kernel;
isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details";
# Derived meta-data
useLLVM = final.isFreeBSD || final.isOpenBSD;
useLLVM = final.isFreeBSD || final.isOpenBSD || final.isLLVMLibc;
Copy link
Member

Choose a reason for hiding this comment

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

OOC does it make sense to ever use LLVM libc with GCC?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hard to say based on whether GCC supports the naked attribute for specific targets. I was thinking the LLVM abi which means to use the libc that it'd make sense to use the entire toolchain. That's what the team upstream thinks as well.

Copy link
Member

Choose a reason for hiding this comment

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

Certainly we'd want $arch-unknown-linux-llvm to use both an LLVM toolchain and libc, but I'm not sure about pkgsLLVMLibc — I think it's a bit surprising that it works differently from pkgsMusl and replaces the toolchain as well. Having it only change the libc would make it more composable (with #303849), and still allow getting to an LLVM toolchain+libc combination with pkgsLLVM.pkgsLLVMLibc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I could drop the LLVM toolchain part once the composable PR lands. It won't work properly without it.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, except maybe then we should just wait for that PR to add this attr, so we don't make a breaking change to it later? It'll still be possible to use LLVM libc by calling Nixpkgs with the appropriate triple.

Copy link
Member Author

Choose a reason for hiding this comment

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

I figured out pkgsLLVM.pkgsLLVMLibc actually doesn't require the composable PR so it should eval right.

@alyssais
Copy link
Member

Eval failure

@RossComputerGuy
Copy link
Member Author

Eval should be fixed now

@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Jan 14, 2025
@RossComputerGuy
Copy link
Member Author

Will likely merge this tomorrow, libunwind and libcxx don't quite work but there's possible fixes. The LLVM libc monthly meeting is tomorrow so I'm hoping to figure out how we can get those building.

@RossComputerGuy RossComputerGuy merged commit e427a1d into NixOS:master Jan 20, 2025
30 of 32 checks passed
@RossComputerGuy RossComputerGuy deleted the feat/llvm-libc branch January 20, 2025 03:42
@Mic92
Copy link
Member

Mic92 commented Jan 20, 2025

This might have broken the r-ryantm-updates bot? nix-community/infra#1676

@emilazy
Copy link
Member

emilazy commented Jan 20, 2025

cc @infinisil shouldn't this have been caught by CI?

@RossComputerGuy
Copy link
Member Author

I was thinking the same thing now that you mention it, I'm not sure why CI didn't catch it.

@infinisil
Copy link
Member

infinisil commented Jan 20, 2025

Might be a case of nix-community/infra#1180

Edit: Nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: lib The Nixpkgs function library 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants