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

sentencepiece: remove static library from the output #99645

Closed
wants to merge 2 commits into from

Conversation

danieldk
Copy link
Contributor

@danieldk danieldk commented Oct 5, 2020

Motivation for this change

Unfortunately, sentencepiece does provide a CMake option to disable
static builds. So just remove it from the output, unless static builds
are enabled.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/339

, cmake
, gperftools

, enableStatic ? false
Copy link
Contributor

Choose a reason for hiding this comment

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

there should be a related:

  sentencepiece = super.sentencepiece.override {
    enableStatic =  true;
  };

in pkgs/top-level/static.nix

Copy link
Contributor Author

@danieldk danieldk Oct 18, 2020

Choose a reason for hiding this comment

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

Thanks! I have added this. I have also disabled building of shared libraries in static builds.

I also added a commit which puts gperftools in buildInputs rather than nativeBuildInputs.

However, building sentencepiece statically fails, because building gperftools fails with:

libtool: link: x86_64-unknown-linux-musl-g++ -std=gnu++11 -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-result -fsized-deallocation -faligned-new -DNO_FRAME_POINTER -g -O2 -o stacktrace_unittest src/tests/stacktrace_unittest.o  ./.libs/libstacktrace.a ./.libs/liblogging.a ./.libs/libfake_stacktrace_scope.a /nix/store/yzda7vvxr4zpmmlp5bfb22s075dm3dhf-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0-lib/x86_64-unknown-linux-musl/lib/../lib64/libstdc++.so -lm -Wl,-rpath -Wl,/nix/store/yzda7vvxr4zpmmlp5bfb22s075dm3dhf-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0-lib/x86_64-unknown-linux-musl/lib/../lib64 -Wl,-rpath -Wl,/nix/store/yzda7vvxr4zpmmlp5bfb22s075dm3dhf-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0-lib/x86_64-unknown-linux-musl/lib/../lib64
/nix/store/9nh6bp6w99kyjsa1gi6ynd3vxp1x66xl-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: attempted static link of dynamic object `/nix/store/yzda7vvxr4zpmmlp5bfb22s075dm3dhf-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0-lib/x86_64-unknown-linux-musl/lib/../lib64/libstdc++.so'

Seems to be the same issue as #76873.

Unfortunately, sentencepiece does provide a CMake option to disable
static builds. So just remove it from the output, unless static builds
are enabled.
@danieldk
Copy link
Contributor Author

danieldk commented Nov 9, 2020

I will close this PR for the time being, using sentencepiece as a shared library can currently lead to issues:

google/sentencepiece#579

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

3 participants