Skip to content

runtime/cgo Undefined symbols for architecture arm64: _darwin_arm_init_mach_exception_handler #46032

@UnivexDont

Description

@UnivexDont

What version of Go are you using (go version)?

go version go1.16.3 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/donto/Library/Caches/go-build"
GOENV="/Users/donto/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/donto/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/donto/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sh/qsg17h7x3137bt_p6qcqh1g80000gn/T/go-build4147123810=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=4e9e4b" -X "github.com/Dreamacro/clash/constant.BuildTime=2021-05-07-1435"' -buildmode=c-archive -o goClash_arm64.a

What did you expect to see?

Build successed && generate .a for iOS

What did you see instead?

runtime/cgo
Undefined symbols for architecture arm64:
"_darwin_arm_init_mach_exception_handler", referenced from:
_x_cgo_init in _x004.o
"_darwin_arm_init_thread_exception_port", referenced from:
_threadentry in _x004.o
_x_cgo_init in _x004.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback (most recent call last):

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions