Skip to content
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

Failing to cross-compile when using gonative, gox and Go 1.5.1 #29

Open
tchap opened this issue Jan 4, 2016 · 14 comments
Open

Failing to cross-compile when using gonative, gox and Go 1.5.1 #29

tchap opened this issue Jan 4, 2016 · 14 comments

Comments

@tchap
Copy link
Contributor

tchap commented Jan 4, 2016

I am using gonative and gox to cross-compile an executable using os/user. It has always been working, but it broke down when CircleCI upgraded their Golang to 1.5.1 I think. Now I am getting user: Current not implemented on darwin/amd64 from the cross-compiled executables. Any ideas what might be wrong now before I try to dive deep into Go 1.5 cross-compilation changes myself?

CC @inconshreveable

@tchap
Copy link
Contributor Author

tchap commented Jan 4, 2016

Hmm, works locally, I will close this before I can prove it's not just CircleCI env setup error...

@tchap tchap closed this as completed Jan 4, 2016
@inconshreveable
Copy link
Owner

It works locally on 1.5.1 but not on circle? That's pretty bizarre.

@tchap
Copy link
Contributor Author

tchap commented Jan 4, 2016

Yeah, something weird. When I do everything locally and try the cross-compiled executable, it works. When I SSH into a CircleCI container and do the same thing manually, I get the error that user.Current is not specified...

@inconshreveable
Copy link
Owner

Some possibilities:

  • Inside circle, the binaries are being built with their version of Go instead of the one created by gonative
  • gonative is failing silently and producing a Go installation that doesn't used the downloaded libraries

@tchap
Copy link
Contributor Author

tchap commented Jan 5, 2016

Thanks for the hints. What is weird for me is that it has always been working just fine, it just broke for some reason recently. I did refactor the build scripts, but they should be doing the same thing...

@tchap
Copy link
Contributor Author

tchap commented Jan 5, 2016

Well, the good part is that I changed the scripts to work locally as well and the executables are broken even when run locally, so the scripts are simply wrong somehow. No idea why it used to work then, but whatever...

@tchap
Copy link
Contributor Author

tchap commented Jan 6, 2016

Actually I am getting the same error locally when using the commands as in README examples, i.e.

$ go get -u github.com/mitchellh/gox
$ <build current gonative using make>
$ cd /your/project
$ gonative build
$ PATH=$PWD/go/bin/:$PATH gox

Weird, I though that this was working...

@tchap tchap reopened this Jan 6, 2016
@tchap
Copy link
Contributor Author

tchap commented Jan 6, 2016

Actually it doesn't work even when I use system Go 1.5.2 like

gox -osarch=darwin/amd64

It starts working when I add -cgo...

@tchap
Copy link
Contributor Author

tchap commented Jan 6, 2016

Seems like a gox issue to me, somehow...

@tchap
Copy link
Contributor Author

tchap commented Jan 6, 2016

I basically don't understand why the following command rebuilds the standard library...

$ GOROOT_BOOTSTRAP="..." gonative build --platforms 'darwin_amd64 linux_amd64 windows_amd64'
...
$ PATH="`pwd`/go/bin:$PATH" GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v
runtime
errors
math
sync/atomic
unicode/utf8
sort
unicode
sync
...

@tchap
Copy link
Contributor Author

tchap commented Jan 6, 2016

Yeah, confirmed that the same thing totally works when using --version 1.4.3 with gonative. Forwarded to golang-nuts mailing list...

@databus23
Copy link

I can't seem to get gonative to work for go >= 1.5. It always seems to rebuild the stdlib.

@databus23
Copy link

Maybe its related to this change: https://go-review.googlesource.com/#/c/9154/.

@tchap
Copy link
Contributor Author

tchap commented Feb 25, 2016

Dunno. I actually asked on the mailing list, but no one replied. I ended up downgrading to Go 1.4.3 actually...

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

No branches or pull requests

3 participants