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
Member

@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

@nixos-discourse nixos-discourse commented Oct 17, 2020

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

@jonringer jonringer Oct 18, 2020

there should be a related:

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

in pkgs/top-level/static.nix

Copy link
Member Author

@danieldk danieldk Oct 18, 2020

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.

danieldk added 2 commits Oct 18, 2020
Unfortunately, sentencepiece does provide a CMake option to disable
static builds. So just remove it from the output, unless static builds
are enabled.
@danieldk danieldk force-pushed the sentencepiece-remove-static branch from 6d7b39c to 28adb93 Oct 18, 2020
@danieldk
Copy link
Member Author

@danieldk 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
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants