这可能是一个奇怪的问题,但是在 MacOS Catalina 升级后,一些用 Go 编写的程序将无法在我的 MacBook Pro 上运行。
然而,一个基本的“Hello World”程序运行,但是我正在使用使用net/http包编写程序我得到以下错误:
注意:程序是正确的,它们在 Docker 容器中运行良好
输出(IntelliJ):
# runtime/cgo
In file included from gcc_darwin_amd64.c:6:
/usr/local/include/pthread.h:331:6: error: macro expansion producing 'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
/usr/local/include/pthread.h:200:2: note: expanded from macro '_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT'
/usr/local/include/pthread.h:331:6: error: macro expansion producing 'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
/usr/local/include/pthread.h:200:34: note: expanded from macro '_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT'
/usr/local/include/pthread.h:540:6: error: macro expansion producing 'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
/usr/local/include/pthread.h:200:2: note: expanded from macro '_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT'
/usr/local/include/pthread.h:540:6: error: macro expansion producing 'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
/usr/local/include/pthread.h:200:34: note: expanded from macro '_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT'
我已经尝试过的事情:
重新安装go
重新安装xcode
检查GOPATH
&GOROOT
是否设置正确
用过的:
MacOS version - Catalina 10.15.6 Go version - go1.15.2 darwin/amd64
梦里花落0921
慕桂英4014372
繁花不似锦
相关分类