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

Nix fails to cross-compile for armv7 due to it using cross-compiled perl during the build #34273

Closed
infinisil opened this issue Jan 25, 2018 · 8 comments

Comments

@infinisil
Copy link
Member

Issue description

Error is

/nix/store/ldwy8j2gbd01v6b7xw5663dirpzkmzyj-builder.sh: line 25:
  /nix/store/05v0bipbd5j9633fwak5x9n88cb5n11d-perl-5.24.3-arm-unknown-linux-gnueabihf/bin/perl:
  cannot execute binary file: Exec format error

Cross-compiling from x86

Steps to reproduce

With latest master(4fec62d):

nix-build '<nixpkgs>' -A nix \
  --arg crossSystem '(import <nixpkgs/lib>).systems.examples.armv7l-hf-multiplatform'

@Ericson2314 @bgamari

@bgamari
Copy link
Contributor

bgamari commented Jan 26, 2018

Which derivation is failing?

@infinisil
Copy link
Member Author

@bgamari /nix/store/7fmg0krqwmza9d1knwzwm952ch6a03yd-perl-DBI-1.636-arm-unknown-linux-gnueabihf.drv

these derivations will be built:
  /nix/store/7fmg0krqwmza9d1knwzwm952ch6a03yd-perl-DBI-1.636-arm-unknown-linux-gnueabihf.drv
  /nix/store/4h338wck7lqbkm5lp0z79y4ai398yji2-perl-DBD-SQLite-1.54-arm-unknown-linux-gnueabihf.drv
  /nix/store/xacfbkk3z5dim2qxpxacn4w1ncvdrmpy-perl-WWW-Curl-4.17-arm-unknown-linux-gnueabihf.drv
  /nix/store/qh2rrfh7slbpnjmplsbzkq0iwxzvcmmq-nix-1.11.16-arm-unknown-linux-gnueabihf.drv
building path(s) ‘/nix/store/w8n4sfblgqcjs43cdjd649kwnr26sjr8-perl-DBI-1.636-arm-unknown-linux-gnueabihf-devdoc’, ‘/nix/store/xisa7vkgpfpbc2amv0fi4xsn9xkksfp6-perl-DBI-1.636-arm-unknown-linux-gnueabihf’
building path(s) ‘/nix/store/5dbmc6ad88ygv89pr2ihw6ndy7y98zmm-perl-WWW-Curl-4.17-arm-unknown-linux-gnueabihf-devdoc’, ‘/nix/store/mwr8kfzksh11x3577iyxxc61w2xxaqis-perl-WWW-Curl-4.17-arm-unknown-linux-gnueabihf’
unpacking sources
unpacking source archive /nix/store/da3r4rlh98m6gd7z9pnqny6sbszqv6pg-DBI-1.636.tar.gz-arm-unknown-linux-gnueabihf
source root is DBI-1.636
setting SOURCE_DATE_EPOCH to timestamp 1461535777 of file DBI-1.636/META.yml
patching sources
configuring
patching ./test.pl...
patching ./ex/corogofer.pl...
patching ./ex/profile.pl...
patching ./ex/perl_dbi_nulls_test.pl...
patching ./dbixs_rev.pl...
patching ./t/53sqlengine_adv.t...
patching ./t/20meta.t...
patching ./t/50dbm_simple.t...
patching ./t/35thrclone.t...
patching ./t/43prof_env.t...
patching ./t/10examp.t...
patching ./t/08keeperr.t...
patching ./t/70callbacks.t...
patching ./t/42prof_data.t...
patching ./t/31methcache.t...
patching ./t/06attrs.t...
patching ./t/07kids.t...
patching ./t/51dbm_file.t...
patching ./t/pod.t...
patching ./t/lib.pl...
patching ./t/30subclass.t...
patching ./t/87gofer_cache.t...
patching ./t/15array.t...
patching ./t/60preparse.t...
patching ./t/14utf8.t...
patching ./t/65transact.t...
patching ./t/pod-coverage.t...
unpacking sources
patching ./t/41prof_dump.t...
unpacking source archive /nix/store/zpxafp58rb7himz6806113ajyk70yji5-WWW-Curl-4.17.tar.gz-arm-unknown-linux-gnueabihf
patching ./t/03handle.t...
patching ./t/86gofer_fail.t...
patching ./t/02dbidrv.t...
patching ./t/11fetch.t...
patching ./t/49dbd_file.t...
patching ./t/19fhtrace.t...
patching ./t/04mods.t...
patching ./t/16destroy.t...
source root is WWW-Curl-4.17
patching ./t/48dbi_dbd_sqlengine.t...
patching ./t/80proxy.t...
setting SOURCE_DATE_EPOCH to timestamp 1392999540 of file WWW-Curl-4.17/lib/WWW/Curl/Share.pm
patching sources
patching ./t/09trace.t...
applying patch /nix/store/fqdblyx63ab469h977kr3dwp7fldaxj6-WWW-Curl-4.17-Skip-preprocessor-symbol-only-CURL_STRICTER.patch
patching file Makefile.PL
patching ./t/52dbm_complex.t...
configuring
patching ./t/85gofer.t...
patching ./t/12quote.t...
patching ./t/40profile.t...
patching ./t/01basics.t...
patching ./t/72childhandles.t...
patching ./t/13taint.t...
patching ./t/16formpost.t...
patching ./t/pod-coverage.t...
/nix/store/ldwy8j2gbd01v6b7xw5663dirpzkmzyj-builder.sh: line 25: /nix/store/05v0bipbd5j9633fwak5x9n88cb5n11d-perl-5.24.3-arm-unknown-linux-gnueabihf/bin/perl: cannot execute binary file: Exec format error
patching ./t/13slowleak.t...
patching ./t/05progress.t...
patching ./t/20undefined_subs.t...
patching ./t/07ftp-upload.t...
patching ./t/21write-to-scalar.t...
patching ./t/19multi.t...
patching ./t/18twinhandles.t...
builder for ‘/nix/store/7fmg0krqwmza9d1knwzwm952ch6a03yd-perl-DBI-1.636-arm-unknown-linux-gnueabihf.drv’ failed with exit code 126
cannot build derivation ‘/nix/store/qh2rrfh7slbpnjmplsbzkq0iwxzvcmmq-nix-1.11.16-arm-unknown-linux-gnueabihf.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/qh2rrfh7slbpnjmplsbzkq0iwxzvcmmq-nix-1.11.16-arm-unknown-linux-gnueabihf.drv’ failed

@Ericson2314
Copy link
Member

Probably need two Perls

@dtzWill
Copy link
Member

dtzWill commented Jan 28, 2018

FWIW the bzip2 workaround I don't think is still needed (or should be addressed differently), curl needs to also be a nativeBuildInput... even so there was a problem cross-compiling IIRC? Will report back shortly.

@dtzWill
Copy link
Member

dtzWill commented Jan 28, 2018

Oh, see @bgamari's cc6e999 for nixUnstable anyway.

Needs some touchups for improvements made in cross support since then, but should get things far enough that nix tries to build.

EDIT: might need misc fixups elsewhere in that branch, sorry! :)

@dtzWill
Copy link
Member

dtzWill commented Jan 28, 2018

Also nixUnstable'll need something like:

From aca3099aba50cd68e2faddd2107edfbf585beeff Mon Sep 17 00:00:00 2001
From: Will Dietz <[email protected]>
Date: Sun, 28 Jan 2018 09:46:12 +0900
Subject: [PATCH] aws-sdk-cpp: disable tests on cross

---
 pkgs/development/libraries/aws-sdk-cpp/default.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkgs/development/libraries/aws-sdk-cpp/default.nix b/pkgs/development/libraries/aws-sdk-cpp/default.nix
index 47d9e7dba4c..26511c22d0b 100644
--- a/pkgs/development/libraries/aws-sdk-cpp/default.nix
+++ b/pkgs/development/libraries/aws-sdk-cpp/default.nix
@@ -33,6 +33,7 @@ in stdenv.mkDerivation rec {
 
   cmakeFlags =
     lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0"
+    ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DENABLE_TESTING=OFF"
     ++ lib.optional (apis != ["*"])
       "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";
 
-- 
2.16.1

@Ericson2314
Copy link
Member

Also can just do hostPlatform.system, and make it unconditional.

@infinisil
Copy link
Member Author

Now builds just fine with

nix-build -A pkgsCross.armv7l-hf-multiplatform.nix

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

No branches or pull requests

4 participants