-
Notifications
You must be signed in to change notification settings - Fork 81
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
Project created through start
script doesn't build in nix shell
#2203
Comments
Apologies if I'm doing something very obviously wrong/stupid, but I've stared at the error message for a while now and it isn't making much sense to me! |
Hi @jonathanlking, I can reproduce the issue inside of the nix dev shell. This seems to be a problem with ghc using the glibc from nix: # gdb /root/.cache/bazel/_bazel_root/35a3e53a80b7147c6d4c8f9a2593f914/external/rules_haskell_ghc_linux_amd64/lib/bin/ghc
(No debugging symbols found in /root/.cache/bazel/_bazel_root/35a3e53a80b7147c6d4c8f9a2593f914/external/rules_haskell_ghc_linux_amd64/lib/bin/ghc)
(gdb) run --interactive
Starting program: /root/.cache/bazel/_bazel_root/35a3e53a80b7147c6d4c8f9a2593f914/external/rules_haskell_ghc_linux_amd64/lib/bin/ghc --interactive
warning: Error disabling address space randomization: Function not implemented
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7e4e84800640 (LWP 145212)]
[New Thread 0x7e4e83e00640 (LWP 145213)]
[New Thread 0x7e4e83400640 (LWP 145214)]
[New Thread 0x7e4e82a00640 (LWP 145215)]
GHCi, version 9.4.6: https://www.haskell.org/ghc/ :? for help
[Detaching after vfork from child process 145216]
[Detaching after vfork from child process 145221]
Thread 1 "ghc" received signal SIGSEGV, Segmentation fault.
0x0000000000027e70 in ?? ()
(gdb) bt
#0 0x0000000000027e70 in ?? ()
#1 0x00007e4e8d9b547e in call_init (l=<optimized out>, argc=argc@entry=2, argv=argv@entry=0x7ffcf5074f58, env=env@entry=0x7ffcf5074f70) at ./elf/dl-init.c:70
#2 0x00007e4e8d9b5568 in call_init (env=0x7ffcf5074f70, argv=0x7ffcf5074f58, argc=2, l=<optimized out>) at ./elf/dl-init.c:33
#3 _dl_init (main_map=0x2123430, argc=2, argv=0x7ffcf5074f58, env=0x7ffcf5074f70) at ./elf/dl-init.c:117
#4 0x00007e4e8560daf5 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:182
#5 0x00007e4e8d9bcff6 in dl_open_worker (a=0x7ffcf50704f0) at ./elf/dl-open.c:808
#6 dl_open_worker (a=a@entry=0x7ffcf50704f0) at ./elf/dl-open.c:771
#7 0x00007e4e8560da98 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#8 0x00007e4e8d9bd34e in _dl_open (file=<optimized out>, mode=-2147483647, caller_dlopen=0x7e4e857c4adb <internal_dlopen+43>, nsid=-2, argc=2, argv=<optimized out>,
env=0x7ffcf5074f70) at ./elf/dl-open.c:883
#9 0x00007e4e8552963c in dlopen_doit (a=a@entry=0x7ffcf5070760) at ./dlfcn/dlopen.c:56
#10 0x00007e4e8560da98 in __GI__dl_catch_exception (exception=exception@entry=0x7ffcf50706c0, operate=<optimized out>, args=<optimized out>)
at ./elf/dl-error-skeleton.c:208
#11 0x00007e4e8560db63 in __GI__dl_catch_error (objname=0x7ffcf5070718, errstring=0x7ffcf5070720, mallocedp=0x7ffcf5070717, operate=<optimized out>, args=<optimized out>)
at ./elf/dl-error-skeleton.c:227
#12 0x00007e4e8552912e in _dlerror_run (operate=<optimized out>, args=<optimized out>) at ./dlfcn/dlerror.c:138
#13 0x00007e4e855296c8 in dlopen_implementation (dl_caller=<optimized out>, mode=1,
file=0x7ffcf50707f8 "/nix/store/j0by58xwyc66f884x0q8rpzvgpwvjmf2-glibc-2.38-77/lib/libc.so.6") at ./dlfcn/dlopen.c:71
#14 ___dlopen (file=file@entry=0x7ffcf50707f8 "/nix/store/j0by58xwyc66f884x0q8rpzvgpwvjmf2-glibc-2.38-77/lib/libc.so.6", mode=mode@entry=1) at ./dlfcn/dlopen.c:81
#15 0x00007e4e857c4adb in internal_dlopen (dll_name=0x7ffcf50707f8 "/nix/store/j0by58xwyc66f884x0q8rpzvgpwvjmf2-glibc-2.38-77/lib/libc.so.6") at rts/Linker.c:601
#16 0x00007e4e857c5557 in addDLL (dll_name=<optimized out>) at rts/Linker.c:769
#17 0x00007e4e87be92c7 in ghcizm9zi4zi6_GHCiziObjLink_czuaddDLL_info ()
from /root/.cache/bazel/_bazel_root/35a3e53a80b7147c6d4c8f9a2593f914/external/rules_haskell_ghc_linux_amd64/lib/bin/../lib/x86_64-linux-ghc-9.4.6/libHSghci-9.4.6-ghc9.4.6
.so
#18 0x0000004200419498 in ?? ()
#19 0x0000000000000000 in ?? () Setting # LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/ $(bazel info output_base)/external/rules_haskell_ghc_linux_amd64/lib/bin/ghc --interactive
GHCi, version 9.4.6: https://www.haskell.org/ghc/ :? for help
/nix/store/yisjp6hkqc1qz8lmgnc0dklx0hgg9w2x-bash-5.2-p15/bin/bash: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/yisjp6hkqc1qz8lmgnc0dklx0hgg9w2x-bash-5.2-p15/bin/bash)
/nix/store/yisjp6hkqc1qz8lmgnc0dklx0hgg9w2x-bash-5.2-p15/bin/bash: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/yisjp6hkqc1qz8lmgnc0dklx0hgg9w2x-bash-5.2-p15/bin/bash)
`gcc' failed in phase `gcc'. (Exit code: 1) It seems running ghc from a bindist is not really supported inside of a nix shell... (at least when you want to mix toolchains from the system and ones from nix) |
@avdv thank you so much for the investigation and explanation 🙏 I think this might be a case of "user error", rather than an issue with rules_haskell, so maybe it's fine to close? |
start
script doesn't buildstart
script doesn't build in nix shell
Yes, I think there is not much we can do in rules_haskell in this case, but the compiler should not crash. Maybe it is just a bad combination of glibc versions / incompatible libraries that causes it... In general, it would be desirable that this works but combining non-nix ghc with nix provided tools is definitely in the not-well-tested area. Lets keep this open to have it visible for others trying the same thing. |
Describe the bug
Trying to build the example project generated with the
start
script fails.To Reproduce
I have used a pure nix shell to try and rule out any local setup on my machine.
flake.nix
Error
Expected behavior
The build to succeed.
Environment
Additional context
sh <(curl https://haskell.build/start)
(rather than the script in the repo) makes no difference.--with-bzlmod=true
also fails.--use-nix
succeeds.The text was updated successfully, but these errors were encountered: