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

Static linking protobuf for gnu64/musl64 fails due to libstdc++.so link attempt #108534

Closed
spease opened this issue Jan 6, 2021 · 4 comments · Fixed by #163489
Closed

Static linking protobuf for gnu64/musl64 fails due to libstdc++.so link attempt #108534

spease opened this issue Jan 6, 2021 · 4 comments · Fixed by #163489
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: static

Comments

@spease
Copy link
Contributor

spease commented Jan 6, 2021

EDIT: I am also getting this now trying to build in CI under Linux

To Reproduce

nix build nixpkgs.pkgsCross.gnu64.pkgsStatic.protobuf
nix build nixpkgs.pkgsCross.musl64.pkgsStatic.protobuf

Screenshots

$ nix build nixpkgs.pkgsCross.gnu64.pkgsStatic.protobuf
builder for '/nix/store/fcrycfc8irav81mz35sx2ypfdixaaygb-protobuf-3.14.0-x86_64-unknown-linux-musl.drv' failed with exit code 2; last 10 log lines:
  libtool: warning: '/nix/store/62flvyknnhx2xc6f3clqqrc206b3417g-x86_64-unknown-linux-musl-stage-final-gcc-debug-10.2.0-lib/x86_64-unknown-linux-musl/lib/libstdc++.la' seems to be moved
  x86_64-unknown-linux-musl-ar: `u' modifier ignored since `D' is the default (see `U')
    CXXLD    protoc
  /nix/store/d7rvcl3n163il4848wx7vblpbgv4nhsw-x86_64-unknown-linux-musl-binutils-2.34/bin/x86_64-unknown-linux-musl-ld: attempted static link of dynamic object `/nix/store/62flvyknnhx2xc6f3clqqrc206b3417g-x86_64-unknown-linux-musl-stage-final-gcc-debug-10.2.0-lib/x86_64-unknown-linux-musl/lib/../lib64/libstdc++.so'
  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:3892: protoc] Error 1
  make[2]: Leaving directory '/private/tmp/nix-build-protobuf-3.14.0-x86_64-unknown-linux-musl.drv-0/source/src'
  make[1]: *** [Makefile:1874: all-recursive] Error 1
  make[1]: Leaving directory '/private/tmp/nix-build-protobuf-3.14.0-x86_64-unknown-linux-musl.drv-0/source'
  make: *** [Makefile:1781: all] Error 2
[2 built (1 failed), 11 copied (204.3 MiB), 40.0 MiB DL]
error: build of '/nix/store/fcrycfc8irav81mz35sx2ypfdixaaygb-protobuf-3.14.0-x86_64-unknown-linux-musl.drv' failed
$ nix build nixpkgs.pkgsCross.musl64.pkgsStatic.protobuf
builder for '/nix/store/fcrycfc8irav81mz35sx2ypfdixaaygb-protobuf-3.14.0-x86_64-unknown-linux-musl.drv' failed with exit code 2; last 10 log lines:
  libtool: warning: '/nix/store/62flvyknnhx2xc6f3clqqrc206b3417g-x86_64-unknown-linux-musl-stage-final-gcc-debug-10.2.0-lib/x86_64-unknown-linux-musl/lib/libstdc++.la' seems to be moved
  x86_64-unknown-linux-musl-ar: `u' modifier ignored since `D' is the default (see `U')
    CXXLD    protoc
  /nix/store/d7rvcl3n163il4848wx7vblpbgv4nhsw-x86_64-unknown-linux-musl-binutils-2.34/bin/x86_64-unknown-linux-musl-ld: attempted static link of dynamic object `/nix/store/62flvyknnhx2xc6f3clqqrc206b3417g-x86_64-unknown-linux-musl-stage-final-gcc-debug-10.2.0-lib/x86_64-unknown-linux-musl/lib/../lib64/libstdc++.so'
  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:3892: protoc] Error 1
  make[2]: Leaving directory '/private/tmp/nix-build-protobuf-3.14.0-x86_64-unknown-linux-musl.drv-0/source/src'
  make[1]: *** [Makefile:1874: all-recursive] Error 1
  make[1]: Leaving directory '/private/tmp/nix-build-protobuf-3.14.0-x86_64-unknown-linux-musl.drv-0/source'
  make: *** [Makefile:1781: all] Error 2
[0 built (1 failed)]
error: build of '/nix/store/fcrycfc8irav81mz35sx2ypfdixaaygb-protobuf-3.14.0-x86_64-unknown-linux-musl.drv' failed

Notify maintainers

@LnL7 @ryan4729 @matthewbauer

Metadata

 - system: `"x86_64-darwin"`
 - host os: `Darwin 20.2.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.9`
 - channels(spease): `"nixpkgs-21.03pre261451.f53c431645d, darwin"`
 - channels(root): `"darwin, nixpkgs-21.03pre261451.f53c431645d"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: protobuf
@spease spease added the 0.kind: bug Something is broken label Jan 6, 2021
@spease spease changed the title Cross-compiling protobuf from darwin to gnu64/musl64 fails due to libstdc++.so link attempt Static linking protobuf with target of or on gnu64/musl64 fails due to libstdc++.so link attempt Jan 6, 2021
@spease spease changed the title Static linking protobuf with target of or on gnu64/musl64 fails due to libstdc++.so link attempt Static linking protobuf for gnu64/musl64 fails due to libstdc++.so link attempt Jan 6, 2021
@spease
Copy link
Contributor Author

spease commented Jan 11, 2021

Looks like this is also similar to #76873 and #76877 and #99645

@spease
Copy link
Contributor Author

spease commented Jan 11, 2021

As I mentioned in the audiofile ticket, my attempted workaround is this:

protobuf = super.protobuf.overrideAttrs (old: {
  preBuild = ''
    sed -iE "s|\([ ']\)[^ ]+libstdc\+\+\.la\([ ']\)|\1\2|g" src/*.la
  '';
});

However this doesn't appear to work because the .la files are not generated by the time of the preBuild hook. Can anyone help with this?

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/trying-to-fix-broken-static-protobuf-compilation/10943/1

@stale
Copy link

stale bot commented Jul 11, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 11, 2021
@vcunat vcunat closed this as completed in 12c37ae Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: static
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants