Skip to content

pciutils: fixup musl support#96012

Closed
baloo wants to merge 1 commit intoNixOS:masterfrom
baloo:baloo/pciutils/static-compilation
Closed

pciutils: fixup musl support#96012
baloo wants to merge 1 commit intoNixOS:masterfrom
baloo:baloo/pciutils/static-compilation

Conversation

@baloo
Copy link
Member

@baloo baloo commented Aug 22, 2020

Motivation for this change

fix build on musl

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.

@ofborg ofborg bot requested a review from vcunat August 22, 2020 18:25
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Aug 22, 2020
@baloo baloo force-pushed the baloo/pciutils/static-compilation branch from c92beef to 4fb0fe3 Compare August 22, 2020 21:01
@vcunat
Copy link
Member

vcunat commented Aug 22, 2020

Is this really because of using musl or because you want a static build? (in which case you want musl)

@baloo
Copy link
Member Author

baloo commented Aug 22, 2020

I'm not too sure I understand the question. When you try to install pkgsStatic.pciutils it will fail with:

nix/store/vy5mz1gxn965wjjw20b3dw0c1px1503j-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/p52ckxpv12wbnppl85qzwhpccs5zr53q-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0/lib/gcc/x86_64-unknown-linux-musl/9.3.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/nix/store/vy5mz1gxn965wjjw20b3dw0c1px1503j-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/p52ckxpv12wbnppl85qzwhpccs5zr53q-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0/lib/gcc/x86_64-unknown-linux-musl/9.3.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/nix/store/vy5mz1gxn965wjjw20b3dw0c1px1503j-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/p52ckxpv12wbnppl85qzwhpccs5zr53q-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0/lib/gcc/x86_64-unknown-linux-musl/9.3.0/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
/nix/store/vy5mz1gxn965wjjw20b3dw0c1px1503j-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/p52ckxpv12wbnppl85qzwhpccs5zr53q-x86_64-unknown-linux-musl-stage-final-gcc-debug-9.3.0/lib/gcc/x86_64-unknown-linux-musl/9.3.0/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
/nix/store/vy5mz1gxn965wjjw20b3dw0c1px1503j-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: final link failed: nonrepresentable section on output
/nix/store/vy5mz1gxn965wjjw20b3dw0c1px1503j-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: final link failed: nonrepresentable section on output

I have binary that depends on pciutils which I'm trying to build statically. As far as I understand, the "is this a static build" switch is stdenv.hostPlatform.isMusl. I might be missing something.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. and removed 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Aug 22, 2020
@vcunat
Copy link
Member

vcunat commented Aug 23, 2020

I meant that musl can be used "normally" (dynamically) and maybe that's even more common, so I wouldn't generally put the implication there. The typical approach for static builds in NixPkgs seems to add configurability to the package and set it in pkgs/top-level/static.nix (and keep default dynamic).

@vcunat
Copy link
Member

vcunat commented Aug 23, 2020

Example: pkgsMusl.pciutils seems to work just fine, with musl and dynamic.

@baloo
Copy link
Member Author

baloo commented Aug 23, 2020

I didn't actually know about pkgsMusl ones. I have to admit. I'll fix that.

Signed-off-by: Arthur Gautier <[email protected]>
@baloo baloo force-pushed the baloo/pciutils/static-compilation branch from 4fb0fe3 to 983967c Compare August 24, 2020 00:30
vcunat added a commit that referenced this pull request Sep 1, 2020
Close PR #96012 (thanks).  This "static style" was discussed on:
#96223 (comment)
@vcunat
Copy link
Member

vcunat commented Sep 1, 2020

We now found a slightly nicer way now, so I used that instead. Thanks.

@vcunat vcunat closed this Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants