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

Cross-compilation failure on OS X host #505

Closed
legal90 opened this issue Nov 26, 2015 · 12 comments
Closed

Cross-compilation failure on OS X host #505

legal90 opened this issue Nov 26, 2015 · 12 comments

Comments

@legal90
Copy link
Contributor

legal90 commented Nov 26, 2015

This issue has been mentioned here: #438 (comment)

$ go version
go version go1.5.1 darwin/amd64

$ make updatedeps
--> Installing build dependencies
--> Updating build dependencies

$ make bin
/Users/legal/go/src/github.com/hashicorp/nomad
==> Getting dependencies...
==> Removing old directory...
==> Building...
Number of parallel builds: 4

-->   windows/amd64: github.com/hashicorp/nomad
-->     linux/amd64: github.com/hashicorp/nomad
-->       linux/386: github.com/hashicorp/nomad
-->    darwin/amd64: github.com/hashicorp/nomad
-->     windows/386: github.com/hashicorp/nomad

2 errors occurred:
--> linux/amd64 error: exit status 2
Stderr: # runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)

--> linux/386 error: exit status 2
Stderr: # runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [bin] Error 1

I'm new with Golang :(. Please, advice - how can I fix that? I believe, it should be possible to cross-compile Nomad for Linux.

P.s. Seems like there is some new stuff in Go 1.5, related to cross-compilation:
http://dave.cheney.net/2015/03/03/cross-compilation-just-got-a-whole-lot-better-in-go-1-5
Is it the reason of this issue?

cc: @cbednarski

@carlosdp
Copy link
Contributor

#421 removes the CGO dependency, so you could just use Go's native cross-compiling.

@legal90
Copy link
Contributor Author

legal90 commented Nov 28, 2015

@carlosdp Thanks! I will subscribe on it.

@cbednarski
Copy link
Contributor

@legal90 Thanks for opening an issue. We are already using the go 1.5 cross-compilation improvements via gox. I will take a look at this today in conjunction with #421.

@cbednarski
Copy link
Contributor

You should now be able to cross-compile with GOOS=linux GOARCH=amd64 build -o bin/nomad . but make bin is still broken. I will need to dig more.

@legal90
Copy link
Contributor Author

legal90 commented Dec 4, 2015

Perfect, It works fine!
Thank you, @cbednarski, @c4milo

@diptanu
Copy link
Contributor

diptanu commented Dec 14, 2015

Just updating this issue, we will have to go back to CGO since the user lookup mechanism based on /etc/passwd is not working on coreos

@carlosdp
Copy link
Contributor

Where does coreos store that?

@legal90
Copy link
Contributor Author

legal90 commented Dec 21, 2015

@diptanu So now (due to #591) this issue is reproduced again:

2 errors occurred:
--> linux/amd64 error: exit status 2
Stderr: # runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)

--> linux/386 error: exit status 2
Stderr: # runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Should it be reopen?

@dadgar
Copy link
Contributor

dadgar commented Dec 22, 2015

It shouldn't be reopened because this project needs cgo. So cross compiling should not be expected to work.

@legal90
Copy link
Contributor Author

legal90 commented Dec 22, 2015

So cross compiling should not be expected to work.

OK, I got it. Thanks.

@calvn
Copy link

calvn commented May 25, 2016

Quick question, does this mean that scripts/build.sh is s broken since it's back to using -cgo? I am encountering the same issue with another project and wanted to see what would be the workaround.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants