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
Start script doesn't work with --use-nix
#1475
Comments
This looks like the underlying Nix build of GHC fails on macOS on a patch step:
Which macOS version are you using? The start script generates
which should try to perform a Nix build equivalent to
Could you check if manually invoking that build passes or fails? nixpkgs 19.03 is a bit old by now. Could you try on 20.09 instead? |
Did your
And did you enable the flag |
macOS Catalina 10.15.7 (19H114)
$ nix build -f https://github.com/NixOS/nixpkgs/archive/19.03.tar.gz ghc
builder for '/nix/store/q325bf3n7y33nszmsn9pgcnxbp3dpava-python3-3.7.3.drv' failed with exit code 1; last 10 log lines:
patching file Lib/distutils/cygwinccompiler.py
patching file Lib/distutils/sysconfig.py
Hunk #1 succeeded at 183 (offset 13 lines).
Hunk #2 succeeded at 202 (offset 13 lines).
Hunk #3 succeeded at 231 (offset 13 lines).
patching file Lib/distutils/unixccompiler.py
Hunk #3 FAILED at 183.
1 out of 3 hunks FAILED -- saving rejects to file Lib/distutils/unixccompiler.py.rej
patching file Makefile.pre.in
Hunk #1 succeeded at 615 (offset 31 lines).
cannot build derivation '/nix/store/26rq8gd6dh6vzn9rzz56ljqdr1sq90wi-ghc-8.6.4.drv': 1 dependencies couldn't be built
[0 built (1 failed), 15.6 MiB DL]
error: build of '/nix/store/26rq8gd6dh6vzn9rzz56ljqdr1sq90wi-ghc-8.6.4.drv' failed Well, that looks to be the issue! Thanks for the diagnosis.
$ nix build -f https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz ghc
[17 copied (2243.8 MiB), 284.3 MiB DL] Looks like it pulled everything from the cache and succeeded. So maybe the start script should be updated? After changing $ BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 bazel run //:example
DEBUG: /private/var/tmp/_bazel_joneshf/30fb5317f87f7a635a57a271880251db/external/rules_haskell/haskell/private/versions.bzl:60:10: WARNING: bazel version is too recent. Supported versions range from 2.1.0 to 3.3.1, but found: 3.7.2
these derivations will be built:
/nix/store/r7s3j21fgqcm5a1apn9w5dgxgsqxxv7r-posix-toolchain.drv
/nix/store/bgmyq1r3fnd47f14j96snaribi7i6k7w-bazel-nixpkgs-posix-toolchain.drv
building '/nix/store/r7s3j21fgqcm5a1apn9w5dgxgsqxxv7r-posix-toolchain.drv'...
created 217 symlinks in user environment
building '/nix/store/bgmyq1r3fnd47f14j96snaribi7i6k7w-bazel-nixpkgs-posix-toolchain.drv'...
/nix/store/xyf55227pidai9j9r7dn7mqhsq9i8a6m-bazel-nixpkgs-posix-toolchain
/nix/store/y0i2ki3i32b2rfvmzaaq85k40k5lwqmc-zlib-1.2.11-dev
these derivations will be built:
/nix/store/i0qxrw8ca6hkixk7wyial6vx6dkvd9w4-bazel-nixpkgs-python-toolchain.drv
building '/nix/store/i0qxrw8ca6hkixk7wyial6vx6dkvd9w4-bazel-nixpkgs-python-toolchain.drv'...
/nix/store/j0rlhx76vjj9r6m8m7qzm1nzrbidmkrr-bazel-nixpkgs-python-toolchain
/nix/store/74slwpsd5xdvy2g2kvzsyrrxhf58js8n-zlib-1.2.11
WARNING: /private/var/tmp/_bazel_joneshf/30fb5317f87f7a635a57a271880251db/external/zlib.dev/BUILD:8:11: in linkstatic attribute of cc_library rule @zlib.dev//:zlib: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'cc_library', the error might have been caused by the macro implementation
INFO: Analyzed target //:example (22 packages loaded, 925 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_joneshf/30fb5317f87f7a635a57a271880251db/external/stackage/BUILD.bazel:12:22: HaskellCabalLibrary @stackage//:zlib failed (Exit 127): cabal_wrapper failed: error executing command bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper lib:zlib zlib-0.6.2.1 true external/stackage/zlib-0.6.2.1/Setup.hs external/stackage/zlib-0.6.2.1 ... (remaining 12 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox cabal_wrapper failed: error executing command bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper lib:zlib zlib-0.6.2.1 true external/stackage/zlib-0.6.2.1/Setup.hs external/stackage/zlib-0.6.2.1 ... (remaining 12 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
env: python: No such file or directory
Target //:example failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /Users/joneshf/programming/joneshf/purs-compile-single/BUILD.bazel:29:15 HaskellCabalLibrary @stackage//:zlib failed (Exit 127): cabal_wrapper failed: error executing command bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper lib:zlib zlib-0.6.2.1 true external/stackage/zlib-0.6.2.1/Setup.hs external/stackage/zlib-0.6.2.1 ... (remaining 12 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox cabal_wrapper failed: error executing command bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper lib:zlib zlib-0.6.2.1 true external/stackage/zlib-0.6.2.1/Setup.hs external/stackage/zlib-0.6.2.1 ... (remaining 12 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
INFO: Elapsed time: 2.909s, Critical Path: 0.25s
INFO: 17 processes: 17 internal.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully This is still using the
Yes.
Yes. |
Glad to hear that fixed the GHC build. Yes, the start script should be updated.
This looks like what's reported here. Is Bazel itself provided by Nix or installed separately? The Python wrapper in nixpkgs's Bazel includes patches to avoid these kinds of issues. Could you retry running |
Sorry, I missed your last message. I also abandoned the project I was working on in the meantime so didn't continue trying to figure this out.
Ah, that makes sense. I was using |
Describe the bug
The start script doesn't work with
--use-nix
. It seems to fail on buildingghc
, but that might be a red herring.To Reproduce
$ curl https://haskell.build/start > start
--use-nix
:$ sh start --use-nix
BAZEL_USE_CPP_ONLY_TOOLCHAIN
on macOS):$ BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 bazel run //:example
Expected behavior
It should work without failure.
Environment
Additional context
I was trying to convert a nix project to using
rules_haskell
but having problems with setting uprules_haskell
myself. I was consistently gettingenv: python: No such file or directory
. I decided to start from scratch and use the instructions in theREADME.md
, but it doesn't seem to work.I also tried the start script without
--use-nix
, and that also failed but with different errors about some C stuff for the zlib package.The text was updated successfully, but these errors were encountered: