-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: some Go executables broken with macOS 10.12.4 / Xcode 8.3 but fine with Xcode 8.2 #19734
Comments
I have the same problem as OP but only for some binaries, not all. When trying to start, it is killed instantly.
I can't figure out the common pattern for broken programs. |
Reproduction: package main
import (
"fmt"
_ "github.com/veandco/go-sdl2/sdl"
)
func init() {
fmt.Println("init")
}
func main() {
fmt.Println("Hello, world")
}
Importing I installed SDL itself via homebrew, the bottled version, a few weeks ago. |
Basically, just using cgo and linking against sdl2 causes the crash: package sdl
// #cgo linux freebsd darwin pkg-config: sdl2
import "C" If you make the above file the whole go-sdl package, the binary will still crash. |
Uhm it looks like lldb is even unable to spawn the binary:
so it seems like the binary is being linked in a way that the OS refuses to run it. /cc @ianlancetaylor |
just the same, cgo make it crash |
same here but with github.com/shirou/gopsutil/cpu instead of sdl2. trying to run the binary with |
Same here, very simple to reproduce:
Investigating the MacOS system logs, it seems to be an issue with taskgated: Maybe a code signature issue around cgo... |
I'll notice that all Go binaries (including working ones) generate the
|
@rasky |
getting signal: killed when trying to use go run *.go go build works, but then i get "Killed: 9" when I try to run the app |
same here, dowloaded Xcode 8.2.1, replaced in /Applications and it works again.. |
For everyone running into this issue, I've been able to build binaries by adding -ldflags -s during the go build phase. |
By default on Darwin the linker will invoke dsymutil to put the debug info directly into the executable. This invocation of dsymutil is disabled by the linker's -s option. Perhaps this is really a bug in dsymutil, or in how dsymutil deals with files created by the Go linker. Could somebody with an affected system please try modifying the code in |
@ianlancetaylor that does fix the problem. Tested on 1.8. |
The call to dsymutil was added to fix #8973. I suppose the next question is: if we don't call dsymutil, what happens when you try to debug a Go program built with cgo? |
I'm seeing this without using cgo, what's the suggested work around - use xcode 8.2? |
@cosnicolaou, see above (#19734 (comment)). Does that not work for you? |
thanks, it works, from reading the comments I thought this was a cgo only problem/fix. It's also painful for our build/automation for obvious reasons. |
would adding these flags to build scripts have any negative repercussions that you're aware of? performance implications or anything like that? |
no, it's just a pain to find all of the invocations etc. |
agreed :) thanks for verifying they are safe to add though |
I have been assuming that takes effect with Go 1.8: Go 1.9 - the first release with that policy - won't invalidate Go 1.8; Go 1.10 will. |
Well, as one datapoint, Kubernetes still hasn't moved from Go 1.7 to Go 1.8, so this means you can't run Kubernetes (even Kubernetes 1.6) on a Mac now. |
Er, build, not run. Maybe that's okay. |
Right, build, and even then only build with newer Xcode. It's not like the gettimeofday crashes. |
This may impact their point release builds, but I'm not sure how Kubernetes does their releases (on an actual Mac, or cross-compiled). Running file on https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/darwin/amd64/kubectl just says |
They can always add -ldflags=-s or update to Go 1.8.1 like everyone else. Also, kubectl at least doesn't appear to have any cgo code in it ( |
Yeah, kubectl seems to be cross compiled (it doesn't use the macOS DNS resolver). |
none of the above workarounds worked for me :( mac os x sierra 10.12.4 before installing command line tools I've removed UPD: it works now! after uninstalling the previous version with |
Update to Go 1.8.1, it is fixed now. |
Go 1.8.1 Works! 🎉 |
OSX 10.12.4 debug symbols breaks go 1.7.3 binaries. Temporarily add -s flag to strip debug info. Revert this commit when we move to 1.8.1 See golang/go#19734 Change-Id: I8d777c82841c75c6b1b28f6b7d69690b93e5fb87
Upstream bug golang/go#19734 Fixes minio#2137
Upstream bug golang/go#19734 Fixes #2137
use go1.8.1 fixed it good |
See couchbase/sync_gateway#2417 for repro steps.
System:
MacBook Pro (x86_64)
macOS 10.12.3 (Sierra)
go version go1.8 darwin/amd64
Xcode 8.3; clang -v
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
What did you do?
See description at
couchbase/sync_gateway#2417
I also found this with some code I am unable to share.
My code does work fine with Xcode 8.2:
clang -v
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
and from reading the bug linked above it works fine there as well.
The text was updated successfully, but these errors were encountered: