Skip to content

libcxxabi: also install libc++abi.a#51960

Merged
FRidh merged 2 commits intoNixOS:masterfrom
Twey:libc++abi.a
Dec 19, 2018
Merged

libcxxabi: also install libc++abi.a#51960
FRidh merged 2 commits intoNixOS:masterfrom
Twey:libc++abi.a

Conversation

@Twey
Copy link
Contributor

@Twey Twey commented Dec 13, 2018

Motivation for this change

Allows building static binaries with libcxxStdenv. The file is only 536K in size, so it seems a waste to throw it away after building it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Twey Twey requested a review from matthewbauer as a code owner December 13, 2018 20:14
@Twey
Copy link
Contributor Author

Twey commented Dec 13, 2018

I haven't touched llvmPackages_3* because they look like they require more work — llvmPackages_3*.libcxx doesn't seem to build static libraries either.

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Dec 13, 2018
Copy link
Member

Choose a reason for hiding this comment

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

In glibc we have a static output. How about this one?

Copy link
Member

Choose a reason for hiding this comment

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

I am not very supportive of static outputs. The issue is lots of things like pkgconfig hardcode the libdir. Instead, i would recommend adding an “enableStatic” argument that can be overriden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modeled this on libstdc++, which just bundles both static and non-static outputs into the gcc derivation.

The static library is pretty small and we were building it anyway and throwing it away. This is meant as a tiny patch that just allows us to build static libraries with libcxxStdenv, which was previously broken. I tried not to make any architectural decisions :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The argument expected by makeStaticLibraries has a double negative — it's called dontDisableStatic. If we're going to add an argument to things, shouldn't we stick to that convention?

[twey@uruz:~/nix/nixpkgs]$ grep -Irc enableStatic | awk -F: '{ s += $2 } END { print s }'
49

[twey@uruz:~/nix/nixpkgs]$ grep -Irc dontDisableStatic | awk -F: '{ s += $2 } END { print s }'
52

There doesn't seem to be consensus 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But there are many more files with the double negative.

[twey@uruz:~/nix/nixpkgs]$ grep -Irl dontDisableStatic | wc -l
49

[twey@uruz:~/nix/nixpkgs]$ grep -Irl enableStatic | wc -l
19

Copy link
Member

Choose a reason for hiding this comment

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

Yeah dontDisableStatic would be fine as well. The double negative is kind of awkward in my opinion though.

But yeah, this sounds okay if it's consistent with how we handle gcc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like it would be weird to have an enableStatic flag just for libc++abi. If anything it should go in libc++ — since static libc++ is useless without static libc++abi.

Are we okay to merge this?

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Dec 17, 2018
@FRidh FRidh merged commit f10a7a2 into NixOS:master Dec 19, 2018
@hedning hedning mentioned this pull request Dec 19, 2018
10 tasks
@Mic92
Copy link
Member

Mic92 commented Dec 19, 2018

This should have not gone to master!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants