go: Undefined symbols: _darwin_arm_init_mach_exception_handler, referenced from: _x_cgo_init in libxxx-go.a[arm64][9](000006.o) _darwin_arm_init_thread_exception_port, referenced from: _threadentry in libxxx-go.a[arm64][9](000006.o) _x_cgo_init in libxxx-go.a[arm64][9](000006.o)
What version of Go are you using (go version)?
$ go version go version go1.21.1 darwin/arm64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go envGO111MODULE=‘’ GOARCH=‘arm64’ GOBIN=‘’ GOCACHE=‘/Users/xxx/Library/Caches/go-build’ GOENV=‘/Users/xxx/Library/Application Support/go/env’ GOEXE=‘’ GOEXPERIMENT=‘’ GOFLAGS=‘’ GOHOSTARCH=‘arm64’ GOHOSTOS=‘darwin’ GOINSECURE=‘’ GOMODCACHE=‘/Users/xxx/go/pkg/mod’ GONOPROXY=‘’ GONOSUMDB=‘’ GOOS=‘darwin’ GOPATH=‘/Users/xxx/go’ GOPRIVATE=‘’ GOPROXY=‘https://proxy.golang.org,direct’ GOROOT=‘/opt/homebrew/Cellar/go/1.21.1/libexec’ GOSUMDB=‘sum.golang.org’ GOTMPDIR=‘’ GOTOOLCHAIN=‘auto’ GOTOOLDIR=‘/opt/homebrew/Cellar/go/1.21.1/libexec/pkg/tool/darwin_arm64’ GOVCS=‘’ GOVERSION=‘go1.21.1’ 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 -ffile-prefix-map=/var/folders/5n/87gntbls2z124zs17r70p5m00000gn/T/go-build4227419323=/tmp/go-build -gno-record-gcc-switches -fno-common’
What did you do?
go build
SDKROOT ?= $(shell xcrun --sdk $(PLATFORM_NAME) --show-sdk-path)
export PATH := $(PATH):/usr/local/bin:/opt/homebrew/bin
CCFLAGS := clang -arch arm64 -isysroot $(SDKROOT) -mtvos-version-min=17.0 -fembed-bitcode
LDFLAGS := -framework CoreFoundation
CGO_ENABLED := 1
GOOS:= arm64
GOARCH:= appletvos // tried with ios/darwin too
CC:= $(CCFLAGS)
CGO_CFLAGS:=
CGO_LDFLAGS := $(LDFLAGS)
// Followed https://go.dev/src/cmd/link/link_test.go?m=text test case for configuration
Go library building fine.
What did you expect to see?
Builded Go library should be build fine with Xcode 15 Apple TV project.
What did you see instead?
Builded Go library throwing below build error on Xcode 15 Apple TV target.
ld: Undefined symbols:
_darwin_arm_init_mach_exception_handler, referenced from:
_x_cgo_init in libxxx-go.a[arm64][9](000006.o)
_darwin_arm_init_thread_exception_port, referenced from:
_threadentry in libxxx-go.a[arm64][9](000006.o)
_x_cgo_init in libxxx-go.a[arm64][9](000006.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OR is there any plan for separate tool for appletvos/arm64 && appletvos/amd64?
$ go tool dist list
…
darwin/amd64
darwin/arm64
…
ios/amd64
iOS/arm64
…
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (8 by maintainers)
Did you also tried building by creating a new user ?
Hi @qinqin0 You need to set below for tvOS,