-
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
Segfault when trying to run dummy main #479
Comments
Hello. Thank you for reporting this. I tried the setup you gave and it works for me. The possibles differences are:
Could you try the following:
|
I tried with newer
But segfault remains. Very likely the problem is around my local nix setup, if that's possible. It's userspace mode nix install on Arch.
Will try on an other machine eventually. |
I suppose you tried with rules_nixpkgs May I also discourage you about using "branch" number for nixpkgs. They are not fixed and can change through time. I'm not even sure I'm having the same |
Thank you @guibou! I installed bazel 0.18 and tried to no improvement. Edit: ignore below, figured I need to give full commit hash like '6a3f5bcb061e1822f50e299f5616a0731636e4e7'. As for the commit - unrelated issue, but I get the following when trying to use a commit hash instead a tag using
|
You should use a full hash. Not the shortened version. I recognize that the UI can be better. |
Ok, figured it, my bad. I had bazel installed not from nix, but from a release binary. If you look at the After installing bazel from nix:
which shows all shared objects are resolved from nix. Might be worth a notice in the documentation to provision bazel using nix? |
OK I think I know why this happens. When non-Nixpkgs Bazel is used, it autoconfigures the CC toolchain based on whatever it finds in the environment. If you're not inside a nix-shell, it'll just pick up your system's GCC, since that is in the However, the fix here isn't to use Bazel from Nixpkgs. Using the official bindist works fine too, provided we tell Bazel to use the CC toolchain from Nixpkgs. Conversely, Bazel from Nixpkgs fails just like bindist Bazel does when it picks up system GCC. It's the same old issue rearing its ugly head (see #259, #304, #250). We need to document that if you're going to use a GHC from Nixpkgs, you probably also want GCC from there too (see tweag/rules_nixpkgs#16). Because the two really want to agree on which glibc to use for some reason. There's actually already a ticket for that: #407. So will close this one. |
The current best practice is to expose the Nixpkgs GCC/Clang via a nix-shell. But see tweag/rules_nixpkgs#40, which moves everything to the |
Very likely a bug in my computer (could only try on one), but filing in case anyone has a hint.
WORKSPACE file:
BUILD file:
Main.hs:
Symptom:
The segfault is from the binary.
LD debug info:
strace tail:
Nix env:
The text was updated successfully, but these errors were encountered: