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
cmd/link: broken binary when code depends on cgo on Darwin #29861
Comments
You are saying that you can't build any program that uses cgo? That seems odd; I don't recall seeing anybody else report that problem. The bit about waiting for 20 minutes doesn't make any sense to me. Does this happen on more than one machine? |
Build always succeeds. Its just when I run it, it errors out. And this seems to be happening only on my machine. Not sure how to proceed with the debugging. And yes I'm not sure how waiting for around 20 minutes changes anything, but it does. |
it's actually 2-3 minutes, not 20 minutes ~/g/s/test ❯❯❯ go build main.go ~/g/s/test ❯❯❯ ./main [1] 29234 killed ./main ~/g/s/test ❯❯❯ date Tue Jan 22 12:50:31 IST 2019 ~/g/s/test ❯❯❯ ./main Hello OSX. ~/g/s/test ❯❯❯ date Tue Jan 22 12:54:03 IST 2019 |
My gut feeling says to check the antivirus or something security related. It could be that it started scanning the executable after building and prevents it from running. So by waiting till the scan finished, it runs normally. |
I think you are right. I'm seeing logs of the executable being scanned in the AntiVirus. I'll talk to the IT team about this. Thanks closing the issue. |
just checked the detailed logs. I see this line |
See https://en.wikipedia.org/wiki/Code_signing Usually it means "don't trust this executable" or "do extra checks" |
Is there something that can be done to get the Antivirus to trust it. like how we need to codesign gdb for it work on mac (https://gist.github.com/hlissner/898b7dfc0a3b63824a70e15cd0180154) |
Not sure if signing would change anything tbh. The quickest and surest way is to just tell the antivirus to don't scan this folder or this executable. |
Okay. I'll check with my IT team then. There seems to be no way for me to add exceptions. |
Seems like this is not a Go issue. Closing. Feel free to reopen if you see the issue even after disabling the Antivirus. |
Seems like an issue with the latest version of xcode command line tools. I downgraded the version and it works fine now. |
System:
MacBook Pro (Retina, 15-inch, Mid 2015)
macOS 10.14.1 (Mojave)
go version go1.11.4 darwin/amd64
Xcode 8.3; clang -v
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin16.4.0
I'm seeing the exact same issue as #12950. Tried both
-ldflags=-s
and-ldflags=-v
no luck.But weirdly enough if I wait for 15-20 mins and then try to execute the file it works, not sure what is happening here.
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputThe text was updated successfully, but these errors were encountered: