-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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 compiler is built using clang, but buildGoPackage function then uses gcc, which can clash #25626
Comments
Yet the line nixpkgs/pkgs/development/compilers/go/1.8.nix Line 137 in 19ebff1
$CC is cc unless on Darwin.
|
(I usually build go-ethereum with |
You are right, I'm not sure what made me think that clang is used, I jumped to some conclusions. Sorry for the misleading title, I'm just very confused now. Can you successfully compile this file: https://raw.githubusercontent.com/golang/go/master/misc/cgo/errors/issue14669.go ? When I do this within |
Further check,
proves that go is compiled with gcc by default on NixOS. Running note: here is an alternative path for gcc for now (that you had figured out the clang one but I can't reproduce), I have |
So you see the error as well for issue14669.go, but are able to successfully run This is what I see when I add go and gcc to configuration.nix and attempt to build the master branch from go-ethereum:
But this series of commands work for you with go and gcc in configuration.nix? |
Yes Update: As stated, I was able to build from the earlier version, but when I pulled from the latest master, I found the same err:
|
From git-bisect, it is due to this commit, in particular the line ethereum/go-ethereum@6ec8135#diff-d9b21908b8e4e705df4660d35ceacfdfR40. |
I am going to close this issue, as it has a really misleading title and wrong speculation. I have written up a - hopefully - better description of the issue here: #25959 . |
Issue description
The NixOS go package uses clang while building the compiler. When that go compiler later is used to compile go programs which make use of C bindings the go compiler will also invoke a C compiler. It seems that this C compiler needs to match the one that was used at build time. If one uses
stdenv.mkDerivation
orbuildGoPackage
one gets gcc instead, which leads to failed builds in some cases.Steps to reproduce
I have an example Go package over here: https://github.com/javgh/nixpkgs/blob/master/pkgs/applications/altcoins/go-ethereum.nix .
For that expression I manually set CC to clang to make it work. Removing that preBuild step leads to a vanilla
buildGoPackage
environment with gcc and the build fails.Tweaking CC in the package directly works for me, but it would probably make more sense to set this correctly already in
buildGoPackage
. I'm pretty new to NixOS, so I haven't yet attempted to do that myself.Technical details
The text was updated successfully, but these errors were encountered: