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

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

Closed
UnivexDont opened this issue May 7, 2021 · 4 comments

Comments

@UnivexDont
Copy link

@UnivexDont UnivexDont commented May 7, 2021

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):

@AlexRouSg
Copy link
Contributor

@AlexRouSg AlexRouSg commented May 7, 2021

Your go version says amd64 but your output says arm64
Please clarify whether you set GOOS and GOARCH

Also is there a reason you are not using golang.org/x/mobile ?

@UnivexDont
Copy link
Author

@UnivexDont UnivexDont commented May 11, 2021

Your go version says amd64 but your output says arm64
Please clarify whether you set GOOS and GOARCH

Also is there a reason you are not using golang.org/x/mobile ?

Thank you so much!
I'll try it.

@UnivexDont UnivexDont closed this May 14, 2021
@UnivexDont
Copy link
Author

@UnivexDont UnivexDont commented May 14, 2021

already fixed

@jaroslavas
Copy link

@jaroslavas jaroslavas commented Jun 9, 2021

So how have you fixed it?

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

Successfully merging a pull request may close this issue.

None yet
4 participants