golang can't start debug, shows framework not found CoreFoundation

Viewed 577

I'm using Macbook pro m1, after data migration or update to monterey(not sure which cause this), golang seems can't debug or go list -compiled. I tried to reinstall/update golang and the result is same

go version: 1.17.3 darwin/arm64

Error msg when I start debug

Build Error: go build -o /var/folders/x8/s3w_s9rj0qj74hs68wvqs1740000gp/T/__debug_bin4251008076 -gcflags all=-N -l .
# runtime/cgo
ld: framework not found CoreFoundation
clang: error: linker command failed with exit code 1 (use -v to see invocation) (exit status 2)

Error msg when go list -compiled

# runtime/cgo
ld: framework not found CoreFoundation
clang: error: linker command failed with exit code 1 (use -v to see invocation)
confcenter

what can i do, any idea?

1 Answers

You need to reinstall the CommandLineTools. xcode-select says everything is up to date, but this information seems to be false.

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Related