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

treewide: Get rid off crossAttrs, and makeStdenvCross #44068

Merged
merged 8 commits into from Jul 25, 2018

Conversation

Ericson2314
Copy link
Member

Motivation for this change

Fixes #33302. makeStdenvCross is no good because it is useless on its own (the stages aren't set up).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Fits CONTRIBUTING.md.

This means we don't need to hackily avoid overwriting `mkDerivation`.
Now that we don't hackily override `mkDerivation`, the TODO is solved
and we just can!
It is inlined into the cross stdenv, which is its last use-case after
the previous commit.
@GrahamcOfBorg GrahamcOfBorg added the 6.topic: stdenv Standard environment label Jul 25, 2018
@Ericson2314 Ericson2314 added this to the 18.09 milestone Jul 25, 2018
@Ericson2314 Ericson2314 added this to After @bgamari's numerous fixes in Cross compilation Jul 25, 2018
@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Jul 25, 2018
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: elfutils, flex, stdenv

Partial log (click to expand)

these paths will be fetched (0.61 MiB download, 3.73 MiB unpacked):
  /nix/store/3s5cz91sbj680w5379cy1y5sj3i45aj6-elfutils-0.173
copying path '/nix/store/3s5cz91sbj680w5379cy1y5sj3i45aj6-elfutils-0.173' from 'https://cache.nixos.org'...
/nix/store/3s5cz91sbj680w5379cy1y5sj3i45aj6-elfutils-0.173
/nix/store/kmmilq8nrd39d43r07n8xqyh05b882k8-flex-2.6.4
/nix/store/033cjd9dvwflpbsdzcv7vg3n4z2578n0-stdenv-linux

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: elfutils, flex, stdenv

Partial log (click to expand)

these paths will be fetched (0.92 MiB download, 5.02 MiB unpacked):
  /nix/store/dl8m39991aaclj5lp8aakl42xzpf9qnz-flex-2.6.4
  /nix/store/g8xmj96pi3843i336myp558sw636gilf-elfutils-0.173
  /nix/store/nzb7mk5b7p09438iyzhs3x6pnil07bvj-hook
copying path '/nix/store/nzb7mk5b7p09438iyzhs3x6pnil07bvj-hook' from 'https://cache.nixos.org'...
copying path '/nix/store/dl8m39991aaclj5lp8aakl42xzpf9qnz-flex-2.6.4' from 'https://cache.nixos.org'...
copying path '/nix/store/g8xmj96pi3843i336myp558sw636gilf-elfutils-0.173' from 'https://cache.nixos.org'...
/nix/store/g8xmj96pi3843i336myp558sw636gilf-elfutils-0.173
/nix/store/dl8m39991aaclj5lp8aakl42xzpf9qnz-flex-2.6.4
/nix/store/mh8ibysaxf1dn3c4yy03xgpj0n1lhs65-stdenv-linux

@Ericson2314
Copy link
Member Author

N.B. this is a cross mass rebuild.

@Ericson2314 Ericson2314 merged commit a6ede9f into NixOS:master Jul 25, 2018
@Ericson2314 Ericson2314 deleted the no-crossAttrs-master branch July 25, 2018 00:15
@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: flex, stdenv

The following builds were skipped because they don't evaluate on x86_64-darwin: elfutils

Partial log (click to expand)

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


these paths will be fetched (0.25 MiB download, 1.12 MiB unpacked):
  /nix/store/k43kp4g5v6czq1jap9qrvz1rakg33sk6-flex-2.6.4
copying path '/nix/store/k43kp4g5v6czq1jap9qrvz1rakg33sk6-flex-2.6.4' from 'https://cache.nixos.org'...
/nix/store/k43kp4g5v6czq1jap9qrvz1rakg33sk6-flex-2.6.4
/nix/store/ffxfrqynir083mrmgdjlcs5yaikpmhl1-stdenv-darwin

@dingxiangfei2009
Copy link
Contributor

dingxiangfei2009 commented Jul 25, 2018

@Ericson2314 Cross compilation fails on this nix-build command on master branch.

nix-build -A hello --arg crossSystem '(import <nixpkgs> {}).lib.systems.examples.musl64'

On NixOS 18.03 x86_64 system, this produces the following error message:

building '/nix/store/xmyzfpqgarfv57lmzj6msc5jhj9k8jkr-stdenv-linux.drv'...
output '/nix/store/zsikvf1x93awxyjmcd4bmad19crfwhrc-stdenv-linux' is not allowed to refer to the following paths:
      /nix/store/mcd0fhq24c634znlryhqwk3qd7f6ijy1-gnu-config-2016-12-31
cannot build derivation '/nix/store/nsnai7yxgdy8b5va4rczs19gahirl49p-linux-headers-4.15-x86_64-unknown-linux-musl.drv': 1 dependencies couldn't be built

Other platforms do not work as well.

@Ericson2314
Copy link
Member Author

Sorry about that. Fixed in #44081

@luigy
Copy link
Contributor

luigy commented Sep 2, 2018

edit: This is being tracked on #45993

@Ericson2314 still getting other errors for aarch64-{android-prebuilt,multiplatform}' that I suspect are related to this?

> nix-build -A hello --arg crossSystem '(import ./. {}).lib.systems.examples.aarch64-android-prebuilt'

these derivations will be built:
  /nix/store/3lhbi028d2ad4i9vddrn7xh4kasx2j7x-bionic-prebuilt-aarch64-unknown-linux-android.drv
  /nix/store/w4nnfxjd7scfb4ri8djhhij8y2f7zzx3-aarch64-unknown-linux-android-ndk-gcc-binutils-wrapper.drv
  /nix/store/871ky1r0n0qsfsxgd6gq3yi4fafzh3jx-aarch64-unknown-linux-android-ndk-gcc-binutils-wrapper.drv
  /nix/store/ffhgm7mh8zh7rr745mzhrd20808b7i9k-stdenv-linux.drv
  /nix/store/if4794r90qv69cs4z262xpq0nh72nw0b-hello-2.10-aarch64-unknown-linux-android.drv
error: a 'aarch64-linux' is required to build '/nix/store/3lhbi028d2ad4i9vddrn7xh4kasx2j7x-bionic-prebuilt-aarch64-unknown-linux-android.drv', but I am a 'x86_64-linux'

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 sort platform than than they will be run on 6.topic: stdenv Standard environment 10.rebuild-darwin: 1-10 10.rebuild-linux: 11-100
Projects
No open projects
Cross compilation
After @bgamari's numerous fixes
Development

Successfully merging this pull request may close these issues.

None yet

4 participants