Closed
Description
As of macOS 10.15, users can build iPad apps to run on macOS using Catalyst. However if you build a framework using gomobile, even though the framework has support for x86_64
, Xcode will display an error.
To fix this, all you need to do is target clang for the macOS sdk & add a cflag with -target x86_64-apple-ios13.0-macabi
. Fully tested example below.
Gomobile should support specifying a target catalyst
. In x/mobile/cmd/gomobile/env.go
, add a new case "catalyst"
for function envInit
which looks like this:
case "catalyst":
clang, cflags, err = envClang('macosx')
cflags += " -target x86_64-apple-ios13.0-macabi"
Activity
losh11 commentedon Feb 1, 2020
@hyangah if y'all are okay with this, I can implement?
agnivade commentedon Feb 2, 2020
All yours !
damiandizeo commentedon Mar 24, 2020
@losh11 added a new case "catalyst" for function envInit , but when I do 'gomobile bind' and create the .framework, Xcode still displaying error in when building on macOS Catalyst. Am I missing something ?
losh11 commentedon Mar 24, 2020
@damiandizeo I'm not able to check exactly what you've done without a full set of diffs. This likely means your framework is not build for
x86_64h
as required by catalyst.damiandizeo commentedon Mar 24, 2020
@losh11 thanks, adding the cflag '-target x86_64-apple-ios13.0-macabi', was able to compile the framework and now runs under Mac Catalyst
losh11 commentedon Mar 25, 2020
Great to hear @damiandizeo, if you or anyone else has time to implement this, that would be awesome. Unfortunately I no longer have the time to do this myself.
set env to accommodate catalyst
dpwiese commentedon Apr 1, 2020
I looked at this quickly last night, and had a bit of trouble coming up with a solution as elegant as I had hoped. The environment is configured in
envInit()
for each architecture inallArchs
. Support for catalyst needs to provide an additional configuring, but for the existingamd64
architecture. I don't think it makes sense to addcatalyst
toallArchs
as a new architecture, as it is not. Treating it as such seems like a poor choice, and furthermore would require many changes throughout to support it if added as a new "architecture".Rather, when setting up the environment in
envInit()
I've simply included it as an additional case alongside the existing true architectures. I've opened a (draft) PR with the current proposed solution here: golang/mobile#45Feedback is appreciated, after which I'll mark ready for review. 🚀
gopherbot commentedon Jul 8, 2021
Change https://golang.org/cl/310949 mentions this issue:
mobile: support macOS and Catalyst
31 remaining items