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

pciutils: fixup musl support #96012

Closed
wants to merge 1 commit into from

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.

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

@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 <baloo@superbaloo.net>
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants