I am using Apple M1 Pro 12.0.1 (21A559). with go version : go1.19.3 darwin/arm64
When I am trying to install gopls, I get the following error.
go install -v golang.org/x/tools/gopls@latest
golang.org/x/tools/gopls /usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1 ld: framework not found CoreFoundation clang: error: linker command failed with exit code 1 (use -v to see invocation)
{
"killed": false,
"code": 2,
"signal": null,
"cmd": "/usr/local/go/bin/go install -v golang.org/x/tools/gopls@latest",
"stdout": "",
"stderr": "go: downloading golang.org/x/tools v0.3.0\ngo: downloading golang.org/x/tools/gopls v0.10.1\ngo: downloading golang.org/x/tools v0.2.1-0.20221101170700-b5bc717366b2\ngo: downloading github.com/sergi/go-diff v1.1.0\ngo: downloading honnef.co/go/tools v0.3.3\ngo: downloading mvdan.cc/gofumpt v0.3.1\ngo: downloading mvdan.cc/xurls/v2 v2.4.0\ngo: downloading golang.org/x/sys v0.1.0\ngo: downloading golang.org/x/mod v0.6.0\ngo: downloading golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4\ngo: downloading golang.org/x/vuln v0.0.0-20221010193109-563322be2ea9\ngo: downloading golang.org/x/text v0.4.0\ngo: downloading golang.org/x/exp/typeparams v0.0.0-20220722155223-a9213eeb770e\ngo: downloading golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e\ngo: downloading github.com/BurntSushi/toml v1.2.0\ngo: downloading github.com/google/go-cmp v0.5.8\n# golang.org/x/tools/gopls\n/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1\nld: framework not found CoreFoundation\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n\n"
}
What is the Target in
clang --version
?I had the same issue and found that the clang binary (I was mistakenly using from a python conda env) had a Target of x86_64-apple-darwin22.2.0. I deleted that binary from my python env and then the clang binary from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin was picked up.
So before I had:
Then after I deleted the unwanted binary using
rm /Users/robtaylor/opt/anaconda3/envs/py38/bin/clang*
I had:So the Target was arm64-apple-darwin22.2.0, which is now correct.