Skip to content
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

mac平台go build报错 #200

Open
Make-1 opened this issue May 11, 2024 · 3 comments
Open

mac平台go build报错 #200

Make-1 opened this issue May 11, 2024 · 3 comments

Comments

@Make-1
Copy link

Make-1 commented May 11, 2024

环境:mac os14.4.1 inter x86 go1.22.1
20240512-012239

以下为我的env

iaomaolvdeMacBook-Pro:src xiaomaolv$ go env
GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/xiaomaolv/Library/Caches/go-build'
GOENV='/Users/xiaomaolv/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/xiaomaolv/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/xiaomaolv/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/xiaomaolv/code/robotclient/go.mod'
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/0t/91tqcw996yl43x0vy0ph3n3w0000gn/T/go-build851118468=/tmp/go-build -gno-record-gcc-switches -fno-common'
@ying32
Copy link
Owner

ying32 commented May 12, 2024

条件有限,我只在14.1.2+go1.22.1+xcode15.0测试正常。从你这个错误来看,要么就是最新的xcode command line工具不正确,或者Apple最新的xcode抛弃了go生成的.o文件格式,但感觉不太可能。

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin23.1.0
Thread model: posix

@Make-1
Copy link
Author

Make-1 commented May 12, 2024

这是我的xcode环境
image

使用开启CGO_ENABLED=1 还是相同的报错
image

@ying32
Copy link
Owner

ying32 commented May 12, 2024

看你这clang版本对比我安装的高好多啊,而且同为xcode15,真是奇怪了。

或者你可以考虑下升级下go的版本看看,从这个看是链接器不认现在go编译的o文件。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants