Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/development/libraries/libcxxrt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ stdenv.mkDerivation {
mkdir -p $out/include $out/lib
cp ../src/cxxabi.h $out/include
cp lib/libcxxrt${stdenv.hostPlatform.extensions.library} $out/lib
cp lib/libcxxrt.a $out/lib
Comment on lines 19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, what I said in #305876 wasn't quite right; stdenv.hostPlatform.extensions.library will yield .a when targeting a static platform:

staticLibrary =
/**/ if final.isWindows then ".lib"
else ".a";
library =
/**/ if final.isStatic then final.extensions.staticLibrary
else final.extensions.sharedLibrary;
executable =
/**/ if final.isWindows then ".exe"
else "";

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:

Suggested change
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

  1. currently this fails with an unrelated error while building libc; pkgsStatic.libcxxrt for x86_64-linux also fails because ld cannot produce lib/libcxxrt.so (shared object) with musl's crtbeginT.o

Copy link
Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

'';

passthru = {
Expand Down