-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime/cgo: Undefined symbols for architecture arm64: _darwin_arm_init_mach_exception_handler when building for Mac Catalyst #47228
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
Comments
It sounds like you are building for a platform (Mac Catalyst) which we have not supported before. If you are requesting a new platform to support, it may be better to open an issue to discuss that. It seems you're using gomobile to build for macOS? Why? I don't think macOS is a mobile platform. Thanks. |
golang.org/x/mobile implements bindings for Objective-C and Java to Go. macOS is an Objective-C platform, and macOS is a supported Go platform. Catalyst is a variant of macOS. |
As far as I can tell, x/mobile's documentation does not mention macOS nor Catalyst. So this is entering undocumented territory. And I also don't think Go runtime code was written with Catalyst support in mind, and we have no test for it. I still suggest you open some discussion about adding support of a new platform. |
That’s because I’m working on macOS and Catalyst support in x/mobile. Where’s the best place/way to open a discussion about a new platform? |
It sounds like Apple is treating Catalyst as an iOS variant, more or less. If there's just a little bit of glue in gomobile to make that work, and maybe a symbol or two in runtime/cgo, then it seems fine - at least for now - to keep using GOOS=ios and see how things go. If there are significant changes required in the main tree, then we should reconsider. |
Now that https://golang.org/cl/334689 is merged,
The changes were pretty minimal to support Catalyst, namely |
I ran into this issue as well, when porting an iOS app that uses a golang c-archive over to an M1 mac using Here is what I observed:
I was able to fix these issues with b26d786 EDIT: Seems like |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Build a cgo library using
gomobile
for Mac Catalyst (UIKit on macOS).What did you expect to see?
A successful build into a framework, and then an XCFramework. (I’m working on #47212 to fix support for Catalyst in
gomobile
.)What did you see instead?
Command
When running
go build -buildmode-c-archive
without-tags=ios
, it fails with an error (Undefined symbols for architecture arm64
).The missing function is called here:
https://github.com/golang/go/blob/master/src/runtime/cgo/gcc_darwin_arm64.c
When building for Catalyst,
TARGET_OS_IPHONE
is defined, so it’s called, butdarwin_arm_init_mach_exception_handler
anddarwin_arm_init_thread_exception_port
aren’t declared.When run with
-tags=ios
, it succeeds. I assume because this file gets compiled in:https://github.com/golang/go/blob/master/src/runtime/cgo/gcc_signal_ios_nolldb.c
Why is this a problem? It seems confusing to supply the
ios
build tag for a macOS target.Catalyst is essentially iOS-on-macOS, but it’s definitely macOS. It uses
GOOS=darwin
, and notGOOS=ios
, and has access to both UIKit and AppKit. It has some other differences from iOS, like access to OpenGL instead of OpenGLES.[lots of env omitted] go build -x -buildmode=c-archive -o $WORK/EchoGo-maccatalyst-arm64.a ./gobind
Partial Output
cc @hajimehoshi
The text was updated successfully, but these errors were encountered: