Skip to content
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

Gomobile xcframework generation #41457

Closed
valself opened this issue Sep 17, 2020 · 2 comments
Closed

Gomobile xcframework generation #41457

valself opened this issue Sep 17, 2020 · 2 comments

Comments

@valself
Copy link

valself commented Sep 17, 2020

Is it possible to generate .xcframework file with gomobile?

I built the .framework file with gomobile with the following command:

gomobile bind -target ios -o ../frameworks/MyFramework.framework

After that I tried to build .xcframework file with this command

xcodebuild -create-xcframework -framework "MyFramework.framework"
-output "MyFramework.xcframework"

But it shows error:

error: binaries with multiple platforms are not supported
'/Users/nicco/myFramework/MyFramework.framework/MyFramework'

So looks like the problem is in gomobile framework generation process.

So I see 2 solutions:

  1. To generate .xcframework file with gomobile.
  2. Change the .framework build process for being able to convert .framework generated file to .xcframework

How to do it?

@tpaschalis
Copy link
Contributor

tpaschalis commented Sep 17, 2020

Thanks for taking the time to open this issue. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

Check https://github.com/golang/go/wiki/Questions for some other venues, more suited for asking questions.

@jerson
Copy link

jerson commented Mar 16, 2021

Hi @valself this could help to generate and xcframework

you need to generate a framework for each architecture

mkdir arm64
gomobile bind -ldflags="-w -s" -target=ios/arm64 -o ./arm64/Openpgp.framework github.com/jerson/openpgp-mobile/openpgp

mkdir amd64
gomobile bind -ldflags="-w -s" -target=ios/amd64 -o ./amd64/Openpgp.framework github.com/jerson/openpgp-mobile/openpgp

and then just merge with xcode command

xcodebuild -create-xcframework \
	-framework ./arm64/Openpgp.framework \
	-framework ./amd64/Openpgp.framework \
	-output Openpgp.xcframework

and thats all, hope this help

@golang golang locked and limited conversation to collaborators Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants