specs: correct mobile Cgo conclusion — iOS is not feasible either#127
Merged
Conversation
An implementation attempt for #125 disproved the spec's iOS conclusion. iOS fails on two independent, unfixable-from-here blockers: - purego refuses to build for ios under CGO_ENABLED=0 (is_ios.go tripwire), so the library cannot compile Cgo-free once it imports purego/objc. - Go's iOS port forces external (C) linking; even an empty program fails 'GOOS=ios CGO_ENABLED=0 go build'. No iOS artifact links without a C toolchain. The original feasibility check ('go build std') was a false positive: it compiles packages but never links and never pulls in purego. Corrected conclusion: both iOS and Android keep Cgo; no source change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Corrects the merged mobile Cgo spec (#123). Implementing #125 disproved its iOS conclusion.
What changed
The spec said iOS was actionable (purego/objc on
UIPasteboard, mirroring darwin #117) and only Android stayed Cgo. That's wrong. iOS cannot drop Cgo either, for two independent reasons — both verified by attempting the implementation:purego/is_ios.go(ios && !cgo) is a deliberate compile-time tripwire (_PUREGO_REQUIRES_CGO_ON_IOS). Once the iOS backend importspurego/objc,GOOS=ios CGO_ENABLED=0 go build .fails to compile. Still true on latest (v0.10.1).func main(){}failsGOOS=ios CGO_ENABLED=0 go buildwithios/arm64 requires external (cgo) linking. darwin (non-iOS) internal-links fine, which is exactly why darwin: remove the Cgo / C-toolchain dependency (purego) (#69) #117 worked and iOS can't.Why the original check was a false positive
The spec's iOS proof was
GOOS=ios CGO_ENABLED=0 go build stdpassing — butgo build stdcompiles packages without linking and without pulling in purego, sidestepping both blockers. The erratum documents the correct check (build the real package with its FFI dep, and link a binary) as a lesson for future platform specs.Result
Docs-only.