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

Go cross compilation #50835

Merged
merged 1 commit into from Nov 24, 2018
Merged

Go cross compilation #50835

merged 1 commit into from Nov 24, 2018

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Nov 20, 2018

Motivation for this change

Mentally prepare myself to cross-compile rust.

Things that work:
  • Cross-compile go packages
    • with c bindings
  • Cross-compile the go compiler itself
  • platforms tested:
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.

@Mic92 Mic92 changed the title Go cross compilation (the compiler) [WIP] Go cross compilation (the compiler) Nov 20, 2018
@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

buildGoPackage will also needs a fix.

@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

It works!

$ nix build -f . pkgsCross.aarch64-multiplatform.direnv
$ file result-bin/bin/direnv
result-bin/bin/direnv: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=nG-gL3ujTEclGyOfQegN/P27GhGurUDo4GMWE8j0G/gCSZ4SGHbAqTQGhK8hxo/wb8SErh3nWiqQUJtIgB7, not stripped

@Mic92 Mic92 changed the title [WIP] Go cross compilation (the compiler) Go cross compilation Nov 20, 2018
@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

buildGoPackage still needs a fix to not put all binaries into a subdirectory:

$ nix build -f . pkgsCross.aarch64-multiplatform.elvish
$ ls -la ./result-bin/bin/linux_arm64
.r-xr-xr-x 9.8M root  1 Jan  1970 elvish

@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

The cross-compiled go compiler suffers from the same problem:
I am sure I am doing something wrong here, because pkgsCross.aarch64-multiplatform.go should be recompiled, which is not the case.

$ nix build -f . pkgsCross.aarch64-multiplatform.go
$ file result/bin/go
result/bin/go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/ld-linux-x86-64.so.2, Go BuildID=B8MPHHZr1IjESQ9jB6zl/lBn5JzDSrtK-Kv4loKzd/JkGv4jGuGPTYbDMg5KFz/7aA2Xi27f1dcZ7gQ-5o6, not stripped
$ file result/bin/linux_arm64/go: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /nix/store/0c1clf8rl63b3l4sqqr1mpp29902m57c-glibc-2.27-aarch64-unknown-linux-gnu/lib/ld-linux-aarch64.so.1, for GNU/Linux 2.6.32, Go BuildID=zkqGWKgg2M2Tt5Mu5Vre/9UyciPL-IZ3lNrDRWPNF/7BE9ligsR-UWT7k_mGCY/SyupUR6i2UyzuB1t250K, not stripped

@Ericson2314 I am pretty sure there is an easy fix to distinguish between a go compiler
that can run on my buildPlatform and a go compiler that run on the targetPlatform. The last one would have an additional install step that moves: result/bin/$GOOS_$GOARCH/* to result/bin/

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)


##### ../test/bench/go1
testing: warning: no tests to run
PASS
ok      _/nix/store/i7n06nb48mnqxh5gr9igfxnmkz5k7viz-go-1.11/share/go/test/bench/go1    3.885s

##### ../test

ALL TESTS PASSED
/nix/store/i7n06nb48mnqxh5gr9igfxnmkz5k7viz-go-1.11

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)


##### ../test/bench/go1
testing: warning: no tests to run
PASS
ok      _/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/test/bench/go1    3.349s

##### ../test

ALL TESTS PASSED
/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11

@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

buildGoPackage is fixed now:

$ nix build -f . pkgsCross.aarch64-multiplatform.elvish
$ file result-bin/bin/elvish
result-bin/bin/elvish: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /nix/store/0c1clf8rl63b3l4sqqr1mpp29902m57c-glibc-2.27-aarch64-unknown-linux-gnu/lib/ld-linux-aarch64.so.1, for GNU/Linux 2.6.32, Go BuildID=s2HUFx1YRJLBf56cDmHU/4QRuig_jqP6FcviBxenT/NasHTJsI-jidztc70wLy/qUhGf8GKE7Aju14I2mlR, not stripped

@@ -184,8 +187,8 @@ go.stdenv.mkDerivation (
runHook preInstall

mkdir -p $bin
dir="$NIX_BUILD_TOP/go/bin"
[ -e "$dir" ] && cp -r $dir $bin
dir="$NIX_BUILD_TOP/go/bin/${gobin_prefix}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should remove the prefix already in the buildPhase in case someone breaks it by overriding installPhase?

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: go_1_11

Partial log (click to expand)


##### ../test/bench/go1
testing: warning: no tests to run
PASS
ok      _/nix/store/8078jhv9k8jwmr5b05fmpgv1n492nwa7-go-1.11/share/go/test/bench/go1    7.695s

##### ../test

ALL TESTS PASSED
/nix/store/8078jhv9k8jwmr5b05fmpgv1n492nwa7-go-1.11

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

/nix/store/i7n06nb48mnqxh5gr9igfxnmkz5k7viz-go-1.11

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: go_1_11

Partial log (click to expand)

/nix/store/8078jhv9k8jwmr5b05fmpgv1n492nwa7-go-1.11

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot link '/nix/store/.links/04ksqdqb0gib4kb7n8sq281s2dwh2ynjgsyq3aizvs69r9l27dc1' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/2b/2b2832799c83b43c48a061e74a02151b52da4c856f9f3c179902aa5c78ab1b2a-a': No space left on device
cannot link '/nix/store/.links/06zzwgvhnxjxglik9wfwnz6p6pw261f7fdp5y5bvnq8myfgzlrdf' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/05/050b7eadf2064d3ba02e2f048240142ab39a72d112071e7d6390b6dbfa9dae46-a': No space left on device
cannot link '/nix/store/.links/0v971q3zcx8w2xdcm5lacbwjy99nshijs62lcis73wlvn3lfyd3r' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/de/deb4480616e487ff6ecc4556b89e9974f4749c21cc15d6f4257b2bf4ffe8c6fa-d': No space left on device
cannot link '/nix/store/.links/0gyg4i9mzjd6ycwvjscyjhyzr871s08l6i0g7j5cmn1hr0axxp2h' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/8a/8a2f766935ef46a16f6be5faff7e8a4d67c5a3087ad675e3daa3b963231f2c38-a': No space left on device
cannot link '/nix/store/.links/0nkpj47aby14ziqn8wvr0zgajr55r4s8q9djh8p77favqqiqrw49' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/61/61a8503557eacbdc0f98a18d291f94889cea0b05a2f530db949dfcbabf534fbd-a': No space left on device
cannot link '/nix/store/.links/0kkm4508vqm3j435md95hrvf5s2s0hdaazzm9g94qbjpa4yfslw4' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/b2/b2583fa61637a0ecc9974620752e15db3305deeb8ce2974a97895e3bdfe23df9-a': No space left on device
cannot link '/nix/store/.links/1i1jgv0bzxm4a9p5pr93ni6gfpm4pgh8las5v57bgsl6234q2365' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/01/01815e62f86fc35631cba5c6dcaa8253114d7729dc4eef450f0ec1857f505076-d': No space left on device
cannot link '/nix/store/.links/0hdyfhjfl2wrman4albznhmsyip5cf1w1zwkr9mfk98519aqvlfw' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/26/26cca724b4fc656e17259e9b0ff4b7b695bb1e014b9632936fd569ffede9e9bb-a': No space left on device
cannot link '/nix/store/.links/07d70fy249d2iwgd8lwffwr6yiazd51ihfmky481p2nk0ldhadka' to '/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11/share/go/pkg/obj/go-build/26/26f6a21815ef3bed90d41fdafb0c82270b2680160cb04ccb83f596a28fb55b8e-a': No space left on device
/nix/store/p322fbg8sv7955m0m9az7gnna1a96abx-go-1.11

@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

Also support C bindings like a charm!

@Mic92
Copy link
Member Author

Mic92 commented Nov 20, 2018

@GrahamcOfBorg build pkgsCross.aarch64-multiplatform.direnv

@GrahamcOfBorg
Copy link

Unexpected error: command failed with exit code 1 on x86_64-linux (full log)

Attempted: pkgsCross.aarch64-multiplatform.direnv

Partial log (click to expand)

cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
output '/nix/store/4g7ar1a1aa3k9n62pa5k5giy7k6qrn0j-go-1.11-aarch64-unknown-linux-gnu' is not allowed to refer to the following paths:
 /nix/store/1dzsd6drn31dgp3hk74x2h87j6jdj55b-perl-5.28.0
cannot build derivation '/nix/store/fvxgijl3f03x8803s1wmkrm1x7fj7c2n-govers-20150109-3b5f175-aarch64-unknown-linux-gnu.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wzz8x17iqcydp1p29fanrkyq8nvl41lp-direnv-2.17.0-aarch64-unknown-linux-gnu.drv': 2 dependencies couldn't be built
error: build of '/nix/store/wzz8x17iqcydp1p29fanrkyq8nvl41lp-direnv-2.17.0-aarch64-unknown-linux-gnu.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pkgsCross.aarch64-multiplatform.direnv

Partial log (click to expand)

strip is /nix/store/6dpnd5aniypn8124mmy8f88s4mq2zl07-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/3xdf3jawkdzidhkl1fblz2qha8wfpqh5-direnv-2.17.0-bin/bin
patching script interpreter paths in /nix/store/3xdf3jawkdzidhkl1fblz2qha8wfpqh5-direnv-2.17.0-bin
checking for references to /build in /nix/store/3xdf3jawkdzidhkl1fblz2qha8wfpqh5-direnv-2.17.0-bin...
cannot find section .dynamic
shrinking RPATHs of ELF executables and libraries in /nix/store/qm6lrk05n45v6gkclj37bx8g51qs66cn-direnv-2.17.0
strip is /nix/store/6dpnd5aniypn8124mmy8f88s4mq2zl07-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/qm6lrk05n45v6gkclj37bx8g51qs66cn-direnv-2.17.0
checking for references to /build in /nix/store/qm6lrk05n45v6gkclj37bx8g51qs66cn-direnv-2.17.0...
/nix/store/3xdf3jawkdzidhkl1fblz2qha8wfpqh5-direnv-2.17.0-bin

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

---
Installed Go for linux/arm64 in /build/source
Installed commands in /build/source/bin

The binaries expect /build/source to be copied or moved to /nix/store/vzvrmjxs2i86ichwf3ww39z1aak1hp7w-go-1.11.2/share/go
running tests
./run.bash: line 8: go: command not found
./run.bash: line 48: exec: go: cannot execute: Is a directory
builder for '/nix/store/rzx8q6gzpirzc2h1y43ymyf9b99g7iwv-go-1.11.2.drv' failed with exit code 126
error: build of '/nix/store/rzx8q6gzpirzc2h1y43ymyf9b99g7iwv-go-1.11.2.drv' failed

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot build derivation '/nix/store/mjfl7wmhd8w01igh6bn72s1ac6a2yzzh-developer_cmds-osx-10.11.6.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/npp83bsip0pi4ljf8vyxjf61v87ijl0w-libutil-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/6pddh23sr6k113jqjiiv6b3r5z0bqa4n-Librpcsvc-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/a27qcfhv8lii0vyq4gs53jhcykl8cg1p-top-osx-10.11.6.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/1ydm8g4jx9i5kaxldq9g2hswzjzs9jfx-system_cmds-osx-10.11.6.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/s5hrwbw20gbl90zm4pkakyhf08ppb731-top-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/kl1bcqk9snzyyx4bn4x2ymv6zy5c5cz6-sysctl-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/ri1bcacbpcn2i8zfbchrls6xgwi233sb-procps-1003.1-2008.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/cg8arfsgc1gs7vwn7ivw194hdx0ak20d-go-1.11.2.drv': 10 dependencies couldn't be built
error: build of '/nix/store/cg8arfsgc1gs7vwn7ivw194hdx0ak20d-go-1.11.2.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
/nix/store/894m0jy0ykghyy3ymf2whkjrqrc5v391-go-1.11.2

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot link '/nix/store/.links/1qiw99r6846zcz7n92v90ihwd1fw54c325cmxip35899d2bvhiqp' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/ff/ff540062b0cbec72f2d8d03011dcb4bbbd88b0d88574cd8c244e1c7f086542c6-d': No space left on device
cannot link '/nix/store/.links/0532pxpchmh4l0ljbafdgm2hlm8jrmd6lyp6mmzsv8iaw4k35fxw' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/3c/3ce4293466601493d750ba25ad4bdd40ac712b80d49f850af7c2d2bc122eacc9-d': No space left on device
cannot link '/nix/store/.links/0vqnm49a7r4j5z8hixyhyp0xii80k19frp8zxscj0d94mqmihdlk' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/78/78cea82d44bddf1deac23d04959c4b0e81db6528b978f6239b57c1ad6ab18636-a': No space left on device
cannot link '/nix/store/.links/085f59rlwgp5q5smwcknnqkfwb9risq4ilijl6hqhwazq09ra5z9' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/d1/d138e0999f31f69920492629e5b73cf17363da82fb8171e138edab40c376089f-a': No space left on device
cannot link '/nix/store/.links/0ncgq2h07pnni6575k941v0gz3kybvy3vy15mxs3wxyiz2j3hj4x' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/94/9436a486609cbccc4a7ddfa38a0d6e9f2fc71362584d7f3a3f9e3644accd4928-a': No space left on device
cannot link '/nix/store/.links/1fz5af1i5s6qqhp0mysz31ylnj0p97p68pgfb0xg402varyi5rl8' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/45/45aa439d9cd7312eb82a0dd73d4d0242213684937607a4207d3f48c04936aa29-a': No space left on device
cannot link '/nix/store/.links/1s3dbwgn58ii0ig8ag0zca6hp8m39k8c9chla1zpcj2al0ard4hb' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/24/242e4e36671d50132ee67deb4a3c44ac04d08a9bcdeadb7e94023238272a5827-a': No space left on device
cannot link '/nix/store/.links/07a71hc1kdmc9xxk4hy8i9wnxwnhnssx59jpjqs2pmm493fclgfk' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/26/269912b0e1f0105d3304d6d9c6d76296e279b47cc3f620f5ec8340fcf1cc3e79-a': No space left on device
cannot link '/nix/store/.links/17w6ynl3fass0cn16a87k2zm8sy5bh6k2fmpx03r2a8sh1cl8cwn' to '/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2/share/go/pkg/obj/go-build/db/dbd92e5fd29233bf2729cd73e0c3c6a40abd1d8fc78a431ebf1bb6b95e4e07c2-d': No space left on device
/nix/store/2n7dhc0sy29lkfajln3g7apnnzhw2g14-go-1.11.2

@Mic92
Copy link
Member Author

Mic92 commented Nov 22, 2018

@GrahamcOfBorg build direnv

@Mic92
Copy link
Member Author

Mic92 commented Nov 22, 2018

@GrahamcOfBorg build pkgsCross.aarch64-multiplatform.direnv

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: direnv

Partial log (click to expand)

strip is /nix/store/yyx28sl7a9n4xs9f82v0llpvrmryanan-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/gydlf1lmqd7nwijwgdaw5h7aisak3qvy-direnv-2.17.0-bin/bin
patching script interpreter paths in /nix/store/gydlf1lmqd7nwijwgdaw5h7aisak3qvy-direnv-2.17.0-bin
checking for references to /build/ in /nix/store/gydlf1lmqd7nwijwgdaw5h7aisak3qvy-direnv-2.17.0-bin...
cannot find section .dynamic
shrinking RPATHs of ELF executables and libraries in /nix/store/yln8y3alsc2zxzyrhs61axc9y6m1wipk-direnv-2.17.0
strip is /nix/store/yyx28sl7a9n4xs9f82v0llpvrmryanan-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/yln8y3alsc2zxzyrhs61axc9y6m1wipk-direnv-2.17.0
checking for references to /build/ in /nix/store/yln8y3alsc2zxzyrhs61axc9y6m1wipk-direnv-2.17.0...
/nix/store/gydlf1lmqd7nwijwgdaw5h7aisak3qvy-direnv-2.17.0-bin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pkgsCross.aarch64-multiplatform.direnv

Partial log (click to expand)

strip is /nix/store/yyx28sl7a9n4xs9f82v0llpvrmryanan-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/vqk9nzmdhlsq19h2fdqczyanfx0kmsg8-direnv-2.17.0-bin/bin
patching script interpreter paths in /nix/store/vqk9nzmdhlsq19h2fdqczyanfx0kmsg8-direnv-2.17.0-bin
checking for references to /build/ in /nix/store/vqk9nzmdhlsq19h2fdqczyanfx0kmsg8-direnv-2.17.0-bin...
cannot find section .dynamic
shrinking RPATHs of ELF executables and libraries in /nix/store/3fq9wyn0y7ljgm6550q652h3jpv7dq5b-direnv-2.17.0
strip is /nix/store/yyx28sl7a9n4xs9f82v0llpvrmryanan-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/3fq9wyn0y7ljgm6550q652h3jpv7dq5b-direnv-2.17.0
checking for references to /build/ in /nix/store/3fq9wyn0y7ljgm6550q652h3jpv7dq5b-direnv-2.17.0...
/nix/store/vqk9nzmdhlsq19h2fdqczyanfx0kmsg8-direnv-2.17.0-bin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

/nix/store/plicr05pvfjwijnl8rzjx9p5h6ldb4ps-go-1.11.2

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pkgsCross.aarch64-multiplatform.direnv

Partial log (click to expand)

strip is /nix/store/br51frm28n8n85bs9wrcx6g8rpa42ain-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/q6lsqp44mcbm034dwz1zdkm08rkcqnpn-direnv-2.17.0-bin/bin
patching script interpreter paths in /nix/store/q6lsqp44mcbm034dwz1zdkm08rkcqnpn-direnv-2.17.0-bin
checking for references to /build/ in /nix/store/q6lsqp44mcbm034dwz1zdkm08rkcqnpn-direnv-2.17.0-bin...
cannot find section .dynamic
shrinking RPATHs of ELF executables and libraries in /nix/store/kv4mr1anasrcbqr1457ayl5siz5r341y-direnv-2.17.0
strip is /nix/store/br51frm28n8n85bs9wrcx6g8rpa42ain-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/kv4mr1anasrcbqr1457ayl5siz5r341y-direnv-2.17.0
checking for references to /build/ in /nix/store/kv4mr1anasrcbqr1457ayl5siz5r341y-direnv-2.17.0...
/nix/store/q6lsqp44mcbm034dwz1zdkm08rkcqnpn-direnv-2.17.0-bin

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

/nix/store/xkbjgmigkpzdmwv84y20cwpipvzlp5ih-go-1.11.2

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot build derivation '/nix/store/mjfl7wmhd8w01igh6bn72s1ac6a2yzzh-developer_cmds-osx-10.11.6.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/npp83bsip0pi4ljf8vyxjf61v87ijl0w-libutil-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/6pddh23sr6k113jqjiiv6b3r5z0bqa4n-Librpcsvc-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/a27qcfhv8lii0vyq4gs53jhcykl8cg1p-top-osx-10.11.6.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/1ydm8g4jx9i5kaxldq9g2hswzjzs9jfx-system_cmds-osx-10.11.6.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/s5hrwbw20gbl90zm4pkakyhf08ppb731-top-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/kl1bcqk9snzyyx4bn4x2ymv6zy5c5cz6-sysctl-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/ri1bcacbpcn2i8zfbchrls6xgwi233sb-procps-1003.1-2008.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/k3fab0lx0waflz7qgaqjy9v77vk4cb41-go-1.11.2.drv': 10 dependencies couldn't be built
error: build of '/nix/store/k3fab0lx0waflz7qgaqjy9v77vk4cb41-go-1.11.2.drv' failed

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: direnv

Partial log (click to expand)

cannot build derivation '/nix/store/6pddh23sr6k113jqjiiv6b3r5z0bqa4n-Librpcsvc-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/a27qcfhv8lii0vyq4gs53jhcykl8cg1p-top-osx-10.11.6.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/1ydm8g4jx9i5kaxldq9g2hswzjzs9jfx-system_cmds-osx-10.11.6.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/s5hrwbw20gbl90zm4pkakyhf08ppb731-top-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/kl1bcqk9snzyyx4bn4x2ymv6zy5c5cz6-sysctl-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/ri1bcacbpcn2i8zfbchrls6xgwi233sb-procps-1003.1-2008.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/74xnm7kn0zr5kbz2a3xrqwn4y2x3f20i-go-1.11.2.drv': 10 dependencies couldn't be built
cannot build derivation '/nix/store/5gh6y8l6xgcfg18nsbmjy3y4qn3aq2ya-govers-20150109-3b5f175.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/bkkvcbria8vca7pwdajsscmnhr0c2bi8-direnv-2.17.0.drv': 4 dependencies couldn't be built
error: build of '/nix/store/bkkvcbria8vca7pwdajsscmnhr0c2bi8-direnv-2.17.0.drv' failed

'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
mv bin/*_*/* bin
rmdir bin/*_*
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dtzWill is cross compilation for pkgsCross.musl64 something we aim for?
The go compiler would break in this case because ${GOHOSTOS}_${GOHOSTARCH} is equal to
${GOOS}_${GOARCH}, which means it would delete the go binaries in that case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably make make the condition GOOS != GOHOSTOS etc. since go doesn’t use a libc it’s kind of irrelevant here… but it should still work in the sense that you have a working compiler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does link against glibc for things like gethostbyname via nss modules.

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot build derivation '/nix/store/mjfl7wmhd8w01igh6bn72s1ac6a2yzzh-developer_cmds-osx-10.11.6.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/npp83bsip0pi4ljf8vyxjf61v87ijl0w-libutil-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/6pddh23sr6k113jqjiiv6b3r5z0bqa4n-Librpcsvc-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/a27qcfhv8lii0vyq4gs53jhcykl8cg1p-top-osx-10.11.6.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/1ydm8g4jx9i5kaxldq9g2hswzjzs9jfx-system_cmds-osx-10.11.6.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/s5hrwbw20gbl90zm4pkakyhf08ppb731-top-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/kl1bcqk9snzyyx4bn4x2ymv6zy5c5cz6-sysctl-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/ri1bcacbpcn2i8zfbchrls6xgwi233sb-procps-1003.1-2008.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/74xnm7kn0zr5kbz2a3xrqwn4y2x3f20i-go-1.11.2.drv': 10 dependencies couldn't be built
error: build of '/nix/store/74xnm7kn0zr5kbz2a3xrqwn4y2x3f20i-go-1.11.2.drv' failed

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: direnv

Partial log (click to expand)

strip is /nix/store/br51frm28n8n85bs9wrcx6g8rpa42ain-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/xvlw6mhwx90sj8k430msqh6bwlakqhw9-direnv-2.17.0-bin/bin
patching script interpreter paths in /nix/store/xvlw6mhwx90sj8k430msqh6bwlakqhw9-direnv-2.17.0-bin
checking for references to /build/ in /nix/store/xvlw6mhwx90sj8k430msqh6bwlakqhw9-direnv-2.17.0-bin...
cannot find section .dynamic
shrinking RPATHs of ELF executables and libraries in /nix/store/18cn0j8cbw6m6lnkf7yyrn8gdczxq44l-direnv-2.17.0
strip is /nix/store/br51frm28n8n85bs9wrcx6g8rpa42ain-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/18cn0j8cbw6m6lnkf7yyrn8gdczxq44l-direnv-2.17.0
checking for references to /build/ in /nix/store/18cn0j8cbw6m6lnkf7yyrn8gdczxq44l-direnv-2.17.0...
/nix/store/xvlw6mhwx90sj8k430msqh6bwlakqhw9-direnv-2.17.0-bin

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: pkgsCross.aarch64-multiplatform.direnv

Partial log (click to expand)

find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
find: '/nix/store/z4mxmw3ysr1qyd9fzk19rm0ljd5rzwrp-govers-20150109-3b5f175': No such file or directory
strip is /nix/store/4wic98ibvzb79nfrlq4gjpnys6d1ywl6-cctools-binutils-darwin/bin/strip
cannot build derivation '/nix/store/dm8awlgwi01ic1ldm63scj0vdhqs7l0q-direnv-2.17.0.drv': 3 dependencies couldn't be built
error: build of '/nix/store/dm8awlgwi01ic1ldm63scj0vdhqs7l0q-direnv-2.17.0.drv' failed

@Mic92 Mic92 merged commit 6f2475f into NixOS:staging Nov 24, 2018
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot link '/nix/store/.links/1jchy1jmkdq6my7vcmnk56x00q2bbm4s1mip4n4scay8bigi19wh' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/fb/fbb0eda0c454d8d2f780469cb2fb6235675cf4cb345ab9d44b69c4672373a43f-a': No space left on device
cannot link '/nix/store/.links/0mw627aj6sy7aj8wf1sin64rwh8xqa0061z3s0874r4ykyajclc2' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/83/83e1cd4a716131e1ca2fa2f2787ed592968ac88f3884aa833b83cb0cd6be0499-a': No space left on device
cannot link '/nix/store/.links/09yiihsb5842cis12pca6lsn3lai20dskrlmll0chmavnr97ncg5' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/0c/0c179afb59aac0c7d9a73725509c78d875b9b3056e218cb4e90ea181e09996a9-a': No space left on device
cannot link '/nix/store/.links/0gqvw9a637j62qb6jgy5vgn3mwprzfdv5729dhk2d9r2gydbhbb7' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/dd/dd5b4f8fe28c29093f687225652120b8f42cf10de99388ad6989dc7c62fa8e56-a': No space left on device
cannot link '/nix/store/.links/1qiw99r6846zcz7n92v90ihwd1fw54c325cmxip35899d2bvhiqp' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/ff/ff540062b0cbec72f2d8d03011dcb4bbbd88b0d88574cd8c244e1c7f086542c6-d': No space left on device
cannot link '/nix/store/.links/1cibh2s3nlx8yr15j5sllf75jpqlz4jbqpl7wljhw24ivfw5am5v' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/be/beeb2facd4d3fb8710f66c10b57e07475cebb24d632d886e2ff8ec3f0e529e59-a': No space left on device
cannot link '/nix/store/.links/1v6ybr5sr4wn1q3ycjfxn7rji7c0h7kq4byjp6xd3w34gmflsm9x' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/be/be9fa9ffb4812fc1d2d5a0930712aefc38b19a94afbbf14c55a9daec060963e6-a': No space left on device
cannot link '/nix/store/.links/1hkfwc6i8890s7am7pgvaaipjlq4vxzcsvbvn6bsv6v3f250cfkw' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/97/9781425a9515ae564fc48178f8ae0bd6451cee09acb8fca0da6dcc96ff8c3c38-a': No space left on device
cannot link '/nix/store/.links/17w6ynl3fass0cn16a87k2zm8sy5bh6k2fmpx03r2a8sh1cl8cwn' to '/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2/share/go/pkg/obj/go-build/db/dbd92e5fd29233bf2729cd73e0c3c6a40abd1d8fc78a431ebf1bb6b95e4e07c2-d': No space left on device
/nix/store/6wh20fc34r5kdb82ni53r2lmg9bb8k70-go-1.11.2

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot build derivation '/nix/store/d6g6xynq83insrjnvcd3dj8sfqj6rddz-developer_cmds-osx-10.11.6.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/bf8x5iq2lbgav7k2v452a5v64m05kfw8-libutil-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/1z9sqwv3mikk694k9810bs1f8k4pn0rz-Librpcsvc-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/a0xnwpa1saryvrjs4zw0axxkz3x0im7s-top-osx-10.11.6.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/95hfh8gdalf99ax42ip38i8yhqjslix1-system_cmds-osx-10.11.6.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/kbra0aqb5plk8209ik17ikdcsjzz01pa-top-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/k4zjq7z2rbcvi1970gyigzc8wkcdfksl-sysctl-1003.1-2008.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/3z8kfmach5ybmi0x9hi6s1d3bbjf4gkb-procps-1003.1-2008.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/h4bpdhz46mrcbnn5328hpbjy7v29g2dv-go-1.11.2.drv': 11 dependencies couldn't be built
error: build of '/nix/store/h4bpdhz46mrcbnn5328hpbjy7v29g2dv-go-1.11.2.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: go_1_11

Partial log (click to expand)

cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
cannot find section .dynamic
/nix/store/vam7x53xk3b63yg5rvmrshqr6pn2ln01-go-1.11.2


# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX
CC_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ericson2314 is that the correct way here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comment was pending and I forgot to submit it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting my thing another way, you can do either way (manual var or depsBuildBuild) the same way for !(build == host == target)

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

Successfully merging this pull request may close these issues.

None yet

5 participants