-
Notifications
You must be signed in to change notification settings - Fork 18k
Crosscompile with race detector fails with fault and panic #49102
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
Comments
how did you install |
Downloaded the official 1.17.2 release, extracted it and moved it into /usr/local/go, then adjusted GOROOT and the PATH in my shell config |
Those symbols are defined in runtime/race/race_linux_arm64.syso . Maybe somehow it didn't get included in the build? Did you set CGO_ENABLED=1 and CC to the path of the C cross compiler when you run the build command? The -extld flag shouldn't be necessary if you set CC correctly. Maybe paste the output of |
@cherrymui You can see in my "go env" output that CC CXX and AR variables are set and CGO_ENABLES is set to 1 |
I verified that with Go 1.17.2 |
Yeah, I saw the go env output. But "go env"'s output depends on GOARCH and GOOS also. It seems when you run "go env" you didn't set GOARCH to arm64 at least as it says |
Ok, thanks for testing, that sounds promising Yes true, I set GOOS and GOARCH just for the command |
Hm... I have switched from the buildroot created compiler to the ubuntu gcc-aarch64-linux-gnu package now... still does not work with a minimal hello world example...
|
Thanks. It looks like the binary release from https://golang.org/dl/go1.17.2.linux-amd64.tar.gz only contains the host platform's race syso file, i.e. it only includes runtime/race/race_linux_amd64.syso but not others (e.g. race_linux_arm64.syso). Maybe you'd need to build from source if you want to cross compile race build, or grab the syso file from the linux-arm64 release package. @golang/release is it intentional that binary releases only include the race syso for the host? Maybe the linker (or the Go command) could give a better error message in this case. I'll look into that. |
Looks intentional: CL 144281 (cmd/release: don't ship race detector *.syso for other platforms). |
Thanks @ALTree . It does look intentional. So @s00500 you'd have to grab the syso from somewhere else, either from the source package or other platform's release package, and place it into GOROOT/src/runtime/race. It seems the main issue is resolved so we can close this. Thanks. I'll look into printing a better error. |
@cherrymui Awesome, I just tested, I took the syso file from the arm64 distribution in src/runtime/race/race_linux_arm64.so and placed it into my local installation Worked like a charm, thanks so much for the superfast help, and yes a better error would definitely help! Have a nice day, thanks again |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am using buildroot with an arm aarch64 setup. Then I use the compiler built there as my crosscompiler in the CGO config. I take a simple golang application that has no CGO dependencys, enable CGO and the -race flag, then it fails in the linking step.
What did you expect to see?
I expected I could make the racedetector crosscompile to arm64 if I setup CGO correctly, strangely it fails, am I doing something wrong or is this usecase not currently supported at all ?
What did you see instead?
Linker errors and sometimes a panic (varies on multiple executions)
The text was updated successfully, but these errors were encountered: