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

Cross compiling ruby pulls in host package despite it being in nativeBuildInputs #91265

Closed
expipiplus1 opened this issue Jun 22, 2020 · 6 comments
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: ruby

Comments

@expipiplus1
Copy link
Contributor

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

  • run nix-build -A pkgsCross.armv7l-hf-multiplatform.ruby on an x86_64 system

  • Observe that it fails trying to run an arm binary of bison

  • Observe that that derivation lists the wrong architecture bison in nativebuildInputs(!)

    , ( "nativeBuildInputs"
      , "/nix/store/p8frky3amk07n2illsnqbn1k8lhy6mci-hook /nix/store/ppb9620xh5gri16lgf6f9sn46mdv2xyk-bison-3.5.4-armv7l-unknown-linux-gnueabihf /nix/store/dbjqx0r50sf5sanmsb0lgyq9zf3vck2k-groff-1.22.4 /nix/store/33nr5mknv9wc75f7lbgnck0z3xipya6s-ruby-2.6.6"
      )
    
  • Remove the bison override for ruby in all-packages.nix

  • Observe that the native bison is used and present in the derivation (although the build fails with this version of bison as expected)

Additional context

I conjecture that bison_3_5 overridesAttrs is somehow interfering with getting the native derivation when it is passed to nativeBuildInputs

Notify maintainers

@FRidh I think you added this override.

@vrthra @manveru maintainers for ruby.

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.42, NixOS, 20.03.git.48723f48ab9M (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.6`
 - nixpkgs: `/home/j/src/nixpkgs2`

Maintainer information:

attribute:
  - pkgsCross.armv7l-hf-multiplatform.ruby
@expipiplus1 expipiplus1 added the 0.kind: bug Something is broken label Jun 22, 2020
@expipiplus1
Copy link
Contributor Author

This certainly doesn't seem like a problem specific to ruby btw.

@veprbl veprbl added 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: ruby labels Jun 22, 2020
@FRidh
Copy link
Member

FRidh commented Jun 22, 2020

fixed with 7bf20d7

@FRidh FRidh closed this as completed Jun 22, 2020
@FRidh
Copy link
Member

FRidh commented Jun 22, 2020

This certainly doesn't seem like a problem specific to ruby btw.

Many expressions have not been written with cross-compilation in mind, and so don't separate native build inputs from host inputs.

@expipiplus1
Copy link
Contributor Author

Thanks @FRidh! Is there a short reason why the usual nativeBuildInputs machinery didn't do this already? It seems to work when one has bison=bison

@FRidh
Copy link
Member

FRidh commented Jun 22, 2020

When you use callPackage, the splicing automatically passes it the correct version (buildPackages or not). However, if you pass in something explicitly, you need to choose. Have a look at #68967 (comment).

@expipiplus1
Copy link
Contributor Author

Thanks again, makes sense!

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 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: ruby
Projects
None yet
Development

No branches or pull requests

3 participants