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

x86 runtime deps in ARM glibc (and most other binaries) #58501

Closed
illegalprime opened this issue Mar 28, 2019 · 0 comments · Fixed by #59787
Closed

x86 runtime deps in ARM glibc (and most other binaries) #58501

illegalprime opened this issue Mar 28, 2019 · 0 comments · Fixed by #59787

Comments

@illegalprime
Copy link
Member

Issue description

building some cross-compiled packages and inspecting their run-time closures:

nix build -f . pkgsCross.aarch64-multiplatform.glibc
nix-store -q --tree result

will show that result depends on /nix/store/b9iyqcsd1gmlfagpi4xqqlswcpx079r1-aarch64-unknown-linux-gnu-stage-final-gcc-debug-7.4.0 (on master d46bf20).

this is because the package isn't spliced correctly:

$ tree -L 2 /nix/store/b9iyqcsd1gmlfagpi4xqqlswcpx079r1-aarch64-unknown-linux-gnu-stage-final-gcc-debug-7.4.0
/nix/store/b9iyqcsd1gmlfagpi4xqqlswcpx079r1-aarch64-unknown-linux-gnu-stage-final-gcc-debug-7.4.0
├── aarch64-unknown-linux-gnu
│   ├── include
│   ├── lib
│   ├── lib64
│   └── sys-include
├── bin
│   ├── aarch64-unknown-linux-gnu-c++
│   ├── aarch64-unknown-linux-gnu-cpp
│   ├── aarch64-unknown-linux-gnu-g++
│   ├── aarch64-unknown-linux-gnu-gcc
│   ├── aarch64-unknown-linux-gnu-gcc-7.4.0
│   ├── aarch64-unknown-linux-gnu-gcc-ar
│   ├── aarch64-unknown-linux-gnu-gcc-nm
│   ├── aarch64-unknown-linux-gnu-gcc-ranlib
│   ├── aarch64-unknown-linux-gnu-gcov
│   ├── aarch64-unknown-linux-gnu-gcov-dump
│   └── aarch64-unknown-linux-gnu-gcov-tool
├── include
├── lib
│   ├── gcc
│   └── libcc1.a
├── lib64 -> lib
├── libexec
│   └── gcc
├── nix-support
│   └── propagated-build-inputs
└── share
    └── locale

The cross compiled packages depend on the aarch64-unknown-linux-gnu/lib folder, but this path also contains x86 binaries in it! (like aarch64-unknown-linux-gnu-gcc).

This causes a bunch of other run-time x86 dependencies to be packaged with the cross-compiled binaries.

@matthewbauer pointed me here: https://github.com/matthewbauer/nixpkgs/blob/static-nix/pkgs/development/compilers/gcc/builder.sh#L203-L287, which is possibly broken.

Trying to move the ARM libs into the lib output caused a cyclic dependency between the lib output and the normal output :( so I'm stuck & posting this issue.

Steps to reproduce

build a cross-compiled binary with a cross gcc, notice that it has x86 binaries in it's run-time closure (assuming the build system is x86):

nix build -f . pkgsCross.aarch64-multiplatform.glibc
nix path-info -r $(readlink -f result) | while read f; do find $f -type f -exec file {} + | grep $(uname -m | tr _ -); done

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.20.6-arch1-1-ARCH, Antergos Linux, noversion
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.1
  • channels(root): "nixpkgs-19.09pre171945.b36dc66bfea"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixpkgs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant