-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
Open
RossComputerGuy
wants to merge
37
commits into
NixOS:master
Choose a base branch
from
RossComputerGuy:feat/toolchain-attrs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+250
−145
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
f8b6a50
lib.systems: introduce cc, bintools, cxxlib, unwinderlib, and rtlib a…
RossComputerGuy dd70d76
cc-wrapper: use new toolchain attributes
RossComputerGuy 8ed961e
alsa-lib: use new toolchain attributes
RossComputerGuy 2fe7a2d
cling: use new toolchain attributes
RossComputerGuy f595cd1
cyrus_sasl: use new toolchain attributes
RossComputerGuy 4303e7c
elfutils: use new toolchain attributes
RossComputerGuy 0024757
kexec-tools: use new toolchain attributes
RossComputerGuy 944dea5
libseccomp: use new toolchain attributes
RossComputerGuy be6da8f
sourceHighlight: use new toolchain attributes
RossComputerGuy 8c1131e
clang: use new toolchain attributes
RossComputerGuy ee4f416
compiler-rt: use new toolchain attributes
RossComputerGuy 64976d4
llvmPackages: use new toolchain attributes
RossComputerGuy 4577079
libcxx: use new toolchain attributes
RossComputerGuy 79d1424
rust: use new toolchain attributes
RossComputerGuy 13497dc
krb5: use new toolchain attributes
RossComputerGuy 50422fa
libunwind: use new toolchain attributes
RossComputerGuy e8848c9
libva: use new toolchain attributes
RossComputerGuy ec7e5fd
openssl: use new toolchain attributes
RossComputerGuy acb6e15
quictls: use new toolchain attributes
RossComputerGuy 604cf6b
graphite2: use new toolchain attributes
RossComputerGuy 402a6f0
pythonPackages.jedi: use new toolchain attributes
RossComputerGuy 5a742d3
pythonPackages.mako: use new toolchain attributes
RossComputerGuy 82bf960
systemd: use new toolchain attributes
RossComputerGuy 33a1aea
windows.crossThreadsStdenv: use new toolchain attributes
RossComputerGuy 5180289
xorg.{libX11,libXt}: use new toolchain attributes
RossComputerGuy 442cabd
pkgs/stdenv/cross/default.nix: use new toolchain attributes
RossComputerGuy fbd0032
stdenvNoLibs: use new toolchain attributes
RossComputerGuy 1f177a7
stdenvNoLibc: use new toolchain attributes
RossComputerGuy a436f63
gccWithoutTargetLibc: use new toolchain attributes
RossComputerGuy 0f89421
threadsCross: use new toolchain attributes
RossComputerGuy d74fade
libcxxrt: use new toolchain attributes
RossComputerGuy 12543fe
busybox: use new toolchain attributes
RossComputerGuy dc8f207
pkgs/top-level/stage.nix: use new toolchain attributes
RossComputerGuy 2315a77
xwayland: use new toolchain attributes
RossComputerGuy 75e5d73
nixVersions.nix_2_26: use new toolchain attributes
RossComputerGuy 019a73b
rutabaga_gfx: use new toolchain attributes
RossComputerGuy 5200443
pythonPackages.cffi: use new toolchain attributes
RossComputerGuy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ | |
|
||
let | ||
|
||
useLLVM = stdenv.hostPlatform.useLLVM or false; | ||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; | ||
haveLibc = stdenv.cc.libc != null; | ||
# TODO: Make this account for GCC having libstdcxx, which will help | ||
|
@@ -92,22 +91,22 @@ stdenv.mkDerivation { | |
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" | ||
] ++ lib.optionals (haveLibc && stdenv.hostPlatform.libc == "glibc") [ | ||
"-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include" | ||
] ++ lib.optionals (useLLVM && haveLibc && stdenv.cc.libcxx == libcxx) [ | ||
] ++ lib.optionals (stdenv.hostPlatform.cxxlib == "libcxx" && haveLibc && stdenv.cc.libcxx == libcxx && !stdenv.hostPlatform.isDarwin) [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it actually right for these to skip Darwin? cc @reckenrode This will presumably want to look at |
||
"-DSANITIZER_CXX_ABI=libcxxabi" | ||
"-DSANITIZER_CXX_ABI_LIBNAME=libcxxabi" | ||
"-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON" | ||
] ++ lib.optionals ((!haveLibc || bareMetal || isMusl || isAarch64) && (lib.versions.major release_version == "13")) [ | ||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" | ||
] ++ lib.optionals (useLLVM && haveLibc) [ | ||
] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && haveLibc && !stdenv.hostPlatform.isDarwin) [ | ||
"-DCOMPILER_RT_BUILD_SANITIZERS=ON" | ||
] ++ lib.optionals (noSanitizers) [ | ||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF" | ||
] ++ lib.optionals ((useLLVM && !haveLibcxx) || !haveLibc || bareMetal || isMusl || isDarwinStatic) [ | ||
] ++ lib.optionals ((stdenv.hostPlatform.rtlib == "compiler-rt" && !haveLibcxx) || !haveLibc || bareMetal || isMusl || isDarwinStatic) [ | ||
"-DCOMPILER_RT_BUILD_XRAY=OFF" | ||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" | ||
"-DCOMPILER_RT_BUILD_MEMPROF=OFF" | ||
"-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary | ||
] ++ lib.optionals (useLLVM && haveLibc) [ | ||
] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && haveLibc && !stdenv.hostPlatform.isDarwin) [ | ||
"-DCOMPILER_RT_BUILD_PROFILE=ON" | ||
] ++ lib.optionals (!haveLibc || bareMetal) [ | ||
"-DCOMPILER_RT_BUILD_PROFILE=OFF" | ||
|
@@ -119,7 +118,7 @@ stdenv.mkDerivation { | |
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" | ||
] ++ lib.optionals (!haveLibc) [ | ||
"-DCMAKE_C_FLAGS=-nodefaultlibs" | ||
] ++ lib.optionals (useLLVM) [ | ||
] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isDarwin) [ | ||
"-DCOMPILER_RT_BUILD_BUILTINS=ON" | ||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program | ||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" | ||
|
@@ -191,7 +190,7 @@ stdenv.mkDerivation { | |
# Hack around weird upsream RPATH bug | ||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) '' | ||
ln -s "$out/lib"/*/* "$out/lib" | ||
'' + lib.optionalString (useLLVM && stdenv.hostPlatform.isLinux) '' | ||
'' + lib.optionalString (stdenv.hostPlatform.rtlib == "compiler-rt" && stdenv.hostPlatform.isLinux) '' | ||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o | ||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o | ||
# Note the history of crt{begin,end}S in previous versions of llvm in nixpkg: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is a bit confusing, since
clangStdenv
is precisely the one that doesn’t uselibc++
by default. But I guess you could override it? (Does it work?)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.
Yes this works, I'm kinda thinking of dropping the
useLLVMLibcxx
attribute and making an override of the stdenv be required but it is handy to be able to switch it easily.