Skip to content

cargo: fix cross-compilation by adding missing zlib dependency#210248

Merged
vcunat merged 1 commit intoNixOS:staging-nextfrom
Mindavi:cargo/cross-fix
Jan 11, 2023
Merged

cargo: fix cross-compilation by adding missing zlib dependency#210248
vcunat merged 1 commit intoNixOS:staging-nextfrom
Mindavi:cargo/cross-fix

Conversation

@Mindavi
Copy link
Contributor

@Mindavi Mindavi commented Jan 11, 2023

Previously it was failing with:

Compiling cargo v0.67.1 (/build/rustc-1.66.1-src/src/tools/cargo)
error: linking with /nix/store/gcc-wrapper-11.3.0/bin/cc failed: exit status: 1
|
= note: /nix/store/binutils-2.39/bin/ld: skipping incompatible /nix/store/zlib-aarch64-unknown-linux-gnu-1.2.13/lib/libz.so when searching for -lz
/nix/store/binutils-2.39/bin/ld: cannot find -lz: No such file or directory
/nix/store/binutils-2.39/bin/ld: skipping incompatible /nix/store/zlib-aarch64-unknown-linux-gnu-1.2.13/lib/libz.so when searching for -lz
collect2: error: ld returned 1 exit status

Description of changes

Add zlib dependency as nativeBuildInput for cargo, since it appears it's needed.

No idea if this should still go in the cycle (#209180), let's discuss.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux (cross-compiled from aarch64-multiplatform)
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

Previously it was failing with:

   Compiling cargo v0.67.1 (/build/rustc-1.66.1-src/src/tools/cargo)
error: linking with `/nix/store/gcc-wrapper-11.3.0/bin/cc` failed: exit status: 1
  |
  = note: /nix/store/binutils-2.39/bin/ld: skipping incompatible /nix/store/zlib-aarch64-unknown-linux-gnu-1.2.13/lib/libz.so when searching for -lz
          /nix/store/binutils-2.39/bin/ld: cannot find -lz: No such file or directory
          /nix/store/binutils-2.39/bin/ld: skipping incompatible /nix/store/zlib-aarch64-unknown-linux-gnu-1.2.13/lib/libz.so when searching for -lz
          collect2: error: ld returned 1 exit status
@Mindavi Mindavi requested review from LnL7, Mic92 and zowoq as code owners January 11, 2023 20:09
@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Jan 11, 2023
@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jan 11, 2023
@vcunat
Copy link
Member

vcunat commented Jan 11, 2023

I'll see if I can find which PR this is related to....

#210139 I expect.

@vcunat vcunat merged commit 39d522f into NixOS:staging-next Jan 11, 2023
@vcunat
Copy link
Member

vcunat commented Jan 11, 2023

OK, let me merge this rebuild optimistically (early), so that it can be fixed in this staging-next iteration without too many rebuilds.

@Mindavi Mindavi deleted the cargo/cross-fix branch January 11, 2023 20:29
@ofborg ofborg bot requested a review from retrry January 11, 2023 20:30
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 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 Jan 11, 2023
@Mindavi
Copy link
Contributor Author

Mindavi commented Jan 12, 2023

This improved the situation somewhat, but didn't totally resolve it. Probably need #196333 for a full fix, but it's a bit in a limbo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants