-
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: gopls -v crashes immediately when linked with Xcode 15 beta #61190
Comments
Hi, just to be sure I understand, these are the steps you followed:
Is that right? Is there any output before the crash? |
Those are the steps I followed. But, I had first tried a version of gopls I had previously built with an earlier Go version/macOS and that also wasn't able to launch. All combinations produced the same output:
|
Thanks again (and sorry I missed that you'd already included the output). CC @golang/runtime for awareness. I'm not sure if this is something we'd normally escalate to Apple. Are you experiencing this type of problem with other Go binaries? |
So far, I have not seen this occur with any other go binaries, but my testing has been pretty limited. I've also filed a bug with Apple about it. |
Would it be possible for you to clone https://github.com/golang/go, checkout tag |
Just ran them, and in fact, they fail.
|
Most of the errors in #61190 (comment) should be addressed with CL stack https://golang.org/cl/505415 . I think they are caused by the (buggy or intentional or a mixture of) behavior changes of Apple's new linker. What version of the C toolchain and Xcode are you using? Could you share the output of
This is more concerning. Does this occur only with previously-built binaries, or it also occurs with new binaries? I'll update my macOS machine to the beta and see tonight... |
Removing the gopls label to hide this from our triage dashboard. Please re-add it if this appears to be directly related to gopls in any way. |
I am using the latest Xcode 15 beta.
I've also confirmed that an older copy of gopls I built with some version of macOS 13 + pre Xcode 15 does seem to work correctly on macOS 14 beta 3. |
Thanks. I found that while
I filed #61229 for the linker issue. Let's keep this issue for the |
I changed a few things while trying to get it working. I'm now building with 1.20.5. What information can I provide to help understand the C toolchain? I've installed Xcode 15 beta 3. I ran your cc command, which seems slightly unhappy on my machine...
|
Does it work? Or still crash?
That command is expected to fail, no worries. Do you still have the binary that fails with |
It crashes when built with 1.20.5, in the same way. I've rebuilt in numerous times, and it always crashes. I tracked down a previous copy I built (built on different OS, toolchain, and Go version) and it runs ok. How exactly can I get the C toolchain version that you are looking for? I just use whatever comes packaged with Xcode. Currently using Xcode 15 beta 3. |
Thanks. If it is a newly built binary crashing, then nothing more needed to find out the C toolchain version. It is Xcode 15 beta 3, which is sufficient. Could you confirm that |
I haven't done a lot of testing, but I compiled a few other simple Go programs and they all worked ok. |
Just want to point out that this isn't just an issue for macOS 14. 😞 I have macOS 13.4.1 but the latest beta version of Xcode CommandLineTools installed as it was suggested via the mac software update tool. Not sure why it's installing beta versions of xcode tools (I didn't realise until I hit this issue)
If anyone else is in the same situation as me I was able to resolve it by downloading the old CommandLineTools from here: https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_14.3.1/Command_Line_Tools_for_Xcode_14.3.1.dmg |
The
which looks like runtime func table is probably corrupted... |
I found that some relocations are resolved to wrong addresses by the new system linker ld-prime. E.g. a field in This causes the runtime func table to be incorrect, which causes the runtime to fail to verify the table and fall into infinite recursion at start. CLs linked at #61229 changes to use a different form of relocation, which is probably what "fixes" the issue. |
@cherrymui I’m currently facing this issue in my machine. If you can provide steps to test your changes I can give it a shot. 🙏 Thanks! |
Thanks @AverageMarcus, downgrading worked for me. I couldn't see a work around described in any of the linked CLs. |
@wtfiscrq issue #61229 linked a number of CLs. If you want to test you can checkout them and build a new Go toolchain. One way of doing it is @bobdoah the CLs include workarounds in the Go toolchain. You need to checkout the CLs and build a new Go toolchain (as mentioned above). If you don't want to build the Go toolchain yourself, here are some other workarounds: |
I submitted a few CLs to the master branch. Now it seems to work fine with Go tip on Intel Mac. Note that you'll need to build PIE binary with It still fails on ARM64 Mac. Some CLs linked at #61229 will work around it, but not yet submitted. One way to checkout the CLs are
The run |
The same problem happens with me when running Delete the crashed version of gopls from GOPATH (the brew install gopls You can check whether it is installed successfully by using the command Finally, copy cp <HOMEBREW_PATH>/bin/gopls <GOPATH>/bin/gopls Restart VS Code and done. |
Thanks @annguyen17-tiki ,this worked for me :) |
@cherrymui I'm willing to check log/versions on my laptops if this would help on tracing the issue. |
@annguyen17-tiki This did not work for me. Every time I open VS Code after copying the executable from homebrew, it does:
I've already copied it there, why does it always try to replace it? and it always replaces it with a broken version. |
I also can't downgrade the XCode tools version. The download page didn't work, and wants me to pay $99 to be an Apple Developer?????? |
I think the bug is fixed in Xcode 15 beta 6. With beta 6, |
gopls version
Tested both 0.11.0 and 0.12.4. Cannot capture version output, as it crashes immediately on launch. Output is:
go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/matt/Library/Caches/go-build"
GOENV="/Users/matt/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/matt/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/matt/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.20.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.20.5/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9_/q1rgv_js2rb518ql_svng32c0000gn/T/go-build3080324972=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Built gopls 0.12.4 with 1.20.5. Ran "gopls -v". Crashes immediately. Things were working fine on beta 2. Now, normally, I'd just wait because this is a beta. But, I always get worried when stuff like this happens, so I figured I'd at least make you aware.
The text was updated successfully, but these errors were encountered: