x/mobile: enable building frameworks for Catalyst #36856
Comments
@hyangah if y'all are okay with this, I can implement? |
All yours ! |
@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 ? |
@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 |
@losh11 thanks, adding the cflag '-target x86_64-apple-ios13.0-macabi', was able to compile the framework and now runs under Mac Catalyst |
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. |
See: golang/go#36856 As of macOS 10.15 target catalyst can be used to build an iPad app to run on macOS. Existing .Framework built with gomobile produces the following error when targetting catalyst: ``` error: Building for Mac Catalyst, but the linked framework 'Sample.framework' was built for iOS + iOS Simulator. You may need to restrict the platforms for which this framework should be linked in the target editor, or replace it with an XCFramework that supports both platforms. (in target 'MySampleApp' from project 'MySampleApp') ``` This commit adds a case for catalyst (although architecture is just amd64) when configuring the environment for each architecture, providing the flags needed to enable the built .Framework to be used with catalyst.
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 Rather, when setting up the environment in Feedback is appreciated, after which I'll mark ready for review. |
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
. Inx/mobile/cmd/gomobile/env.go
, add a new case"catalyst"
for functionenvInit
which looks like this:The text was updated successfully, but these errors were encountered: