Repository navigation
Replies: 1 comment
|
The issue is the Go compiler. It does not allow building iOS with CGO_ENABLED=0 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Question
I'd like to build for
GOOS=ioswithCGO_ENABLED=0, and I'm trying to work out whether the guard inis_ios.gois a hard constraint or a conservative placeholder.internal/fakecgo/go_darwin.gohas two//TODO: support iosblocks —threadentry()wantsdarwin_arm_init_thread_exception_port(), andx_cgo_init()wants that plusdarwin_arm_init_mach_exception_handler()andinit_working_dir().Looking at how upstream
runtime/cgodefines these, two of the three seem to matter less than the TODO suggests:gcc_signal_ios_arm64.c(which defines bothdarwin_arm_init_*functions) is gated//go:build lldb. The non-lldb variant,gcc_signal_ios_nolldb.c, is literally empty bodies for both. So outside lldb-driven test runs those are no-ops in the C path too — meaning the missing piece may not be exception handling at all.init_working_dir()is the one real gap:CFBundleGetMainBundle→CFBundleCopyResourceURL(Info.plist)→chdirto the bundle's parent.zsymbols_darwin.gocurrently imports no CoreFoundation symbols, so that would be the only new dependency.The build tags don't look like the obstacle either —
go/build'smatchTagmakesGOOS=iosalso matchdarwin, so fakecgo's!cgo && darwinfiles already compile into an iOS build; only the explicit_PUREGO_REQUIRES_CGO_ON_IOSinis_ios.gostops it.So:
_PUREGO_REQUIRES_CGO_ON_IOScurrently a "not done yet" marker rather than a measured requirement?init_working_diris the only real gap — is it even desirable for a library embedded in someone else's iOS app? Itchdirs the host process to the Bundle root, which is a process-wide side effect; Go's comment notes the CWD otherwise starts at/on iOS. Not doing it may be the better behavior, which would make this smaller rather than larger.pthread_sigmask/TLS specifics on iOS, main-thread constraints, or simply that CI has noGOOS=iosjob (.github/workflows/test.ymlcovers windows/darwin/linux/freebsd/netbsd but not ios)?Context: I'm porting a Go UI framework that drives AppKit through purego under the same no-cgo rule, and iOS is currently the one target that rule excludes. Your answer decides whether that's a temporary gap or a permanent boundary.
All reactions