Conversation
|
@ofborg eval |
| cp lib/libcxxrt${stdenv.hostPlatform.extensions.library} $out/lib | ||
| cp lib/libcxxrt.a $out/lib |
There was a problem hiding this comment.
Apologies, what I said in #305876 wasn't quite right; stdenv.hostPlatform.extensions.library will yield .a when targeting a static platform:
nixpkgs/lib/systems/default.nix
Lines 126 to 134 in 65f3d71
This means that nix-build --arg crossSystem '{ system = "x86_64-freebsd13"; useLLVM = true; isStatic = true; }' -A libcxxrt would1 yield a libcxxrt that has lib/libcxxrt.a.
Given that the staticlib is relatively small, providing it even when !hostPlatform.isStatic seems reasonable to me (especially since libc++.a isn't gated on isStatic) but I'll defer to @alyssais on this.
If we do want libcxxrt to expose both the shared and static versions of the library I think the above should become something like:
| cp lib/libcxxrt${stdenv.hostPlatform.extensions.library} $out/lib | |
| cp lib/libcxxrt.a $out/lib | |
| cp lib/libcxxrt${stdenv.hostPlatform.extensions.staticLibrary} $out/lib | |
| '' + lib.optionalString stdenv.hostPlatform.hasSharedLibraries '' | |
| cp lib/libcxxrt${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib |
Footnotes
-
currently this fails with an unrelated error while building
libc;pkgsStatic.libcxxrtforx86_64-linuxalso fails becauseldcannot producelib/libcxxrt.so(shared object) withmusl'scrtbeginT.o↩
There was a problem hiding this comment.
this seems slightly overly pedantic to me tho i suppose what i have breaks in the windows case. but this is more work then i care to do so closing.
There was a problem hiding this comment.
I'm sorry. I appreciate the work you're doing and did not mean to discourage you.
Agreed that the above isn't an important change; if it's okay with the libcxxrt package maintainer, I'm happy with this PR as is.
Description of changes
allow static linking libc++. libcxxrt.a is 220K when build for x64 linux, 198K x64 freebsd
tested with #305876
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-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.