-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
lib.systems: introduce toolchain, cc, and bintools attributes #365057
base: master
Are you sure you want to change the base?
Conversation
7a3eca0
to
2a005fa
Compare
9c8b44b
to
f6da63d
Compare
The main idea and motivation is in: pkgs/stdenv/cross/default.nix |
f6da63d
to
ec79349
Compare
10cd2ba
to
2b4d320
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the direction this is going in -- if there's an enum, make it be an enum, not a set of booleans.
I'd appreciate a "next steps" portion of this PR, where you give some guidance on how and what's going to happen next, especially if there are breaking changes.
Next step is to add exports for LD or change exports for LD to the linker explicitly set. The idea is the bintools and linker can be less connected. From there, it'll probably be more explicit defining of the CC and other tools. Maybe a setup hook inside CC wrapper or other stuff could do it. Then I'll redo my CPU model PR and make some of that optimization stuff more flexible between different compilers.
Probably any other things we could look into doing that makes it easier to add an LLVM bootstrap to Linux. |
Hmm. I like the design. But I wonder about backwards compatibility. Will users suddenly experience this not working as expected in their existing expressions? (orthogonal) Ideas:
I don't know what level of support users should expect of these (existing) attributes, but I can say that I would probably find things quite confusing when this lands, had I not seen this PR. |
Yeah, it'll just not work lol
Tried as a warning or throw but it was causing stdenv to fail.
This could work, I can easily add in asserts to the platform stuff to make that work.
Mentioned earlier, tried this. We'd see like 8 warning every time stdenv is used.
This is likely the simplest and best solution. Add a few asserts which check to ensure nobody is passing the deprecated attributes. |
It is possible to use clang with the GCC runtimes. Is a straightforward expression available here which would be of the form Today for instance |
Afaict, that's already possible and the default behavior on Linux. |
I realise, but just trying to think through the meaning of these new values (and also the old ones such as useLLVM); and whether they are clear and expressive enough. |
These new values are more fine grain, useLLVM already conveyed to use the LLVM toolchain. The compiler attribute only switches out the compiler being used. Linker only will change the linker and bintools changes the binary tools. However, toolchain is a more "global" control that changes all the options. This allows for more precise control over the platform's build environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(just glanced, this is a conceptual review)
I knee this day would come :)
2b4d320
to
4f26b52
Compare
Darwin’s toolchain is mostly LLVM. It uses clang. It uses most LLVM bintools except for a handful of things:
How would Darwin be represented in this taxonomy? |
Darwin is an odd one
That is close, the linker defaults to cctools. I don't think we'd support changing these options much outside of Linux. It's just simpler enough to support as is outside of Linux. |
4f26b52
to
5a22d29
Compare
It’s currently |
I’ll add that addressing Darwin support beyond the default doesn’t have to be part of this PR, but I would like to see what such support would like so it can be addressed separately. |
Oh gotcha
Yeah, I can make that happen once I start making the linker attribute work separately from bintools in my follow up PR.
It should, I'm not sure whether it actually does work as intended.
It can be, it applies through everything using |
Things done
Replaces
useLLVM
,useArocc
, anduseZig
withtoolchain
,cc
,linker
, andbintools
attributes. This might not produce any rebuilds but we'll see. This has the advantage of preventingusing${compiler}
flags from colliding and not working correctly if we were to stack multiplepkgs*
together.nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.