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

runtime/race: support cross compilation #7552

Closed
dvyukov opened this issue Mar 15, 2014 · 6 comments
Closed

runtime/race: support cross compilation #7552

dvyukov opened this issue Mar 15, 2014 · 6 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Mar 15, 2014

Currently race cross compilation fails:

$ uname -a
Darwin .... 11.4.2 Darwin Kernel Version 11.4.2: Fri Sep  6 15:20:13 PDT 2013;
root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

$ GOOS=linux go build

$ GOOS=linux go build -race
# github.com/highwire/hwcrawl/cmd/hwcrawl
runtime.raceinit: undefined: runtime/race.Initialize
dl_iterate_phdr(0): not defined
pthread_attr_setstacksize(0): not defined


It depends on cgo cross compilation:
https://golang.org/issue/4714

When that is fixed, we need to test that race cross builds work as well.
@rsc
Copy link
Contributor

rsc commented Apr 3, 2014

Comment 1:

Labels changed: added release-none, removed release-go1.3maybe.

@dvyukov
Copy link
Member Author

dvyukov commented Feb 13, 2015

The cgo cross compilation is fixed. This issue need to be test. But I don't have native cross compiling compiler. Can somebody test it using CC_FOR_TARGET?

@minux
Copy link
Member

minux commented Feb 13, 2015

I have no trouble building binaries for darwin/amd64 with race detector on
linux/amd64 using pkg/darwin_amd64_race/* from official darwin/amd64
binary distribution. If the program itself doesn't use cgo, then cross compiling
with race detector doesn't even need a working cross compiler.

@minux minux closed this as completed Feb 13, 2015
@gavrie
Copy link

gavrie commented Aug 12, 2015

This still happens.
I'm trying to cross-compile with Go 1.5beta3 for Linux on a Mac with the race detector, and get the following error:

$ go version
go version go1.5beta3 darwin/amd64
$ export GOOS=linux
$ export GOARCH=amd64
$ go build -race -i -v -o build/linux_amd64/master ./cmd/master
github.com/elastifile/master/cmd/master
# github.com/elastifile/master/cmd/master
runtime/race(.text): __libc_malloc: not defined
runtime/race(.text): getuid: not defined
runtime/race(.text): pthread_self: not defined
runtime/race(.text): madvise: not defined
runtime/race(.text): madvise: not defined
runtime/race(.text): madvise: not defined
runtime/race(.text): sleep: not defined
runtime/race(.text): usleep: not defined
runtime/race(.text): abort: not defined
runtime/race(.text): isatty: not defined
runtime/race(.text): __libc_free: not defined
runtime/race(.text): getrlimit: not defined
runtime/race(.text): pipe: not defined
runtime/race(.text): __libc_stack_end: not defined
runtime/race(.text): getrlimit: not defined
runtime/race(.text): setrlimit: not defined
runtime/race(.text): setrlimit: not defined
runtime/race(.text): setrlimit: not defined
runtime/race(.text): exit: not defined
runtime/race(.text.unlikely): __errno_location: not defined
runtime/race(.text): undefined: __libc_malloc
/usr/local/Cellar/go/1.5beta3/libexec/pkg/tool/darwin_amd64/link: too many errors

@ianlancetaylor
Copy link
Contributor

@gavrie That's a different problem. Please open a different issue. Thanks.

In the new issue, please add the output of "go build -x". I'm surprised that errors are coming from tool/darwin_amd64/link. That suggests that it hasn't even gotten to the GNU/Linux part of the build. It may be an error selecting the linker, or it may be an error in rebuilding the tools.

Do you by any chance have GOROOT set in the environment? If you do, try removing it.

@gavrie
Copy link

gavrie commented Aug 12, 2015

Done, see #12122. I have not set GOROOT.

@golang golang locked and limited conversation to collaborators Aug 22, 2016
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