Skip to content
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

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

Merged
merged 2 commits into from Dec 19, 2018
Merged

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

merged 2 commits into from Dec 19, 2018

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
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.

@@ -33,6 +33,7 @@ stdenv.mkDerivation {
''
else ''
install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.a $out/lib
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?

@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants