Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

gb build failed for go1.5 #319

Closed
linuxerwang opened this issue Aug 23, 2015 · 15 comments
Closed

gb build failed for go1.5 #319

linuxerwang opened this issue Aug 23, 2015 · 15 comments

Comments

@linuxerwang
Copy link

I upgraded to go1.5, rebuilt the whole gb pkg/cmds, and "gb build" gave error:

FATAL command "build" failed: fork/exec /usr/share/go-golang/pkg/tool/linux_amd64/6g: no such file or directory

Also tried to rebuild gb with build tag (I know it's redundant):

go install --tags 'go1.5' github.com/constabulary/gb/cmd/gb
go install --tags 'go1.5' github.com/constabulary/gb/cmd/gb-vendor

But still "gb build" failed with the above error.

Thanks.

@davecheney
Copy link
Contributor

It's likely that gb didn't get rebuilt, you can try adding the -v flag to go install, and seeing if it's actually doing anything.

Personally, I recommend removing $GOPATH/pkg and running go install -v .../cmd/gb

@linuxerwang
Copy link
Author

Same issue. I even manually deleted .a and binary.

rm -rf pkg/linux_amd64/github.com/constabulary/gb/*
rm -rf bin/gb*
go install -v .../cmd/gb
go install -v .../cmd/gb-vendor

@davecheney
Copy link
Contributor

Are you saying that go install did nothing ? Can you please include the
full output of what you see ?

On Sun, Aug 23, 2015 at 4:07 PM, linuxerwang notifications@github.com
wrote:

Same issue. I even manually deleted .a and binary.

rm -rf pkg/linux_amd64/github.com/constabulary/gb/*
rm -rf bin/gb*
go install -v .../cmd/gb
go install -v .../cmd/gb-vendor


Reply to this email directly or view it on GitHub
#319 (comment).

@davecheney
Copy link
Contributor

/usr/share/go-golang/pkg/tool/linux_amd64/6g is not a common installation path for Go. Where did you get this go install from ? Do you or have you set GOROOT ? If so, please do not, and repeat the procedure.

@davecheney
Copy link
Contributor

Can you please include the ouput of which go, is it the version you expect ?

@linuxerwang
Copy link
Author

gb and gb-vendor were installed correctly, I can run "gb vendor fetch" without problem. The problem is when running "gb build".

I build my go1.5 from source code. And there is no 6g under /usr/share/go-golang/pkg/tool/linux_amd64/6g. I think go1.5 removed all 6g/6l etc. according to the release notes: https://golang.org/doc/go1.5#compiler_and_tools

No I did not set GOROOT.

@davecheney
Copy link
Contributor

Thank you for confirming. My suspicion is that your go installation is not correct, and that incorrect value is being encoded into gb when it is compiled (because it must know this value to know where to find the compiler).

The fact that gb is using the go 1.4 behavior (looking for 6g, not compile) also lead me to believe that the go installation on your computer is not correct.

How have you installed go ? If you uninstall go and then issue go, does it suceed ? What are the values on your $PATH ?

@linuxerwang
Copy link
Author

I downloaded the go1.5 source tarball, set GOROOT and GOROOT_FINAL to /usr/share/go-golang; compile the source with all.bash; the copy the whole source folder to /usr/share/go-golang; then create a symbol link /usr/bin/go to /usr/share/go-golang/bin/go.

user@host:/usr/share/go-golang$ tree -L 1
.
├── api
├── AUTHORS
├── bin
├── CONTRIBUTING.md
├── CONTRIBUTORS
├── doc
├── favicon.ico
├── lib
├── LICENSE
├── misc
├── PATENTS
├── pkg
├── README.md
├── robots.txt
├── src
├── test
└── VERSION

Thanks.

@linuxerwang
Copy link
Author

And go env output:

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/me/go"
GORACE=""
GOROOT="/usr/share/go-golang"
GOTOOLDIR="/usr/share/go-golang/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

$ go version
go version go1.5 linux/amd64

@davecheney
Copy link
Contributor

Why would you do this ? Just download the binary tarball from the Go website and unpack it to the recommended location. This binary tarball is very well tested and known to work.

If you do wish to compile from source, my strongest recommendation is to not set GOROOT and compile to a directory owned by your user. I outline the procedure here.

http://dave.cheney.net/2014/09/13/how-to-install-multiple-versions

I recommend following the advice outlined above and expect that this will resolve your problem installing gb.

@linuxerwang
Copy link
Author

Still not working for me.

a). I rebuilt go from source. This time I didn't set any GOROOT paths. I untar source code to /home/tools/go-go1.5, built there, put bin in path. Removed pkg/ bin/ for gb. Generated gb and gb-vendor. "gb build" failed the same way.

$ /home/tools/go-go1.5/bin/go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/me/go"
GORACE=""
GOROOT="/home/tools/go-go1.5"
GOTOOLDIR="/home/tools/go-go1.5/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

b) I downloaded the prebuilt go tarball from golang.org. Note that it needs to be extracted to /usr/local/go. Repeated the above steps, "gb build" failed the same way.

$ /usr/local/go/bin/go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/me/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

@linuxerwang
Copy link
Author

I have to go to bed now. But please let me know if anything else I should do to figure out the problem. Thanks.

@davecheney
Copy link
Contributor

I'm sorry I haven't been able to fix it for you. Can you please confirm the modification time on your gb binary. Are you sure it is being rebuilt, are you sure that is the version that is being executed in your path ?

I added a check to gb in 34bdc62 that should fail if the version of Go that build gb does not match the version of Go that is installed. Can you please try

 go get -u github.com/constabulary/gb/...

To download the latest version.

@linuxerwang
Copy link
Author

The last look before go to bed. You are right! Didn't remember when I copied gb/gb-vendor to /usr/bin. That gave me a hard time. It's totally my fault.

Thank you so much, Dave.

@davecheney
Copy link
Contributor

You're welcome, I'm glad you were able to find the problem.

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

No branches or pull requests

2 participants