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

iOS Simulator on Apple Silicon M1 #11

Open
DmitryDNKK opened this issue Feb 13, 2023 · 10 comments
Open

iOS Simulator on Apple Silicon M1 #11

DmitryDNKK opened this issue Feb 13, 2023 · 10 comments

Comments

@DmitryDNKK
Copy link

There is no build for iOS simulators running on Apple's new arm processors.

@EchoLunar
Copy link

I’m encountering the same issue. I reviewed the iosbuild.sh script for libwebp, and it also doesn’t include separate builds for Apple Silicon simulators.

From my understanding, it should be similar to Carthage, with one framework for iPhoneOS arm64 and another for x86_64 & arm64 for the simulator, then compiled into an XCFramework.

I’m not very experienced with this, so I hope someone can handle it. As a temporary solution, I’m using x86_64 and arm64 .a files. Xcode shows many yellow warnings, but it doesn’t affect functionality.

@feuvan
Copy link
Owner

feuvan commented Sep 9, 2024

@EchoLunar I've updated the build script to output XCFramework. Please give a try.

@EchoLunar
Copy link

I’m really surprised and impressed that you managed to solve my issue so quickly! I’ve successfully compiled and run it on both the M2 simulator and the iPhone device. Thank you so much for your help!

@feuvan
Copy link
Owner

feuvan commented Sep 9, 2024

glad to hear that.

@feuvan feuvan closed this as completed Sep 9, 2024
@EchoLunar
Copy link

EchoLunar commented Sep 9, 2024

Hey~ I apologize. I did manage to compile successfully on both the simulator and the real device, but when I tried to upload the package, Apple rejected it. It was then that I realized the xcframework contains a .a file, while typically, an xcframework should contain something like what’s shown in the picture.

image
Asset validation failed (90432)
Unexpected file found in Frameworks. The “XXX.app/Frameworks/libopencore-amrnb.a” file is in the Frameworks directory, but the Swift runtime libraries are the only files permitted in that directory.

@feuvan
Copy link
Owner

feuvan commented Sep 9, 2024

@EchoLunar try the prebuilt xcframeworks. They are built by github actions with xcodebuild.

@feuvan feuvan reopened this Sep 9, 2024
@EchoLunar
Copy link

EchoLunar commented Sep 9, 2024

I have tried, but the result remains the same. When I package and submit it to TestFlight, I receive the following error: “The X.app/Frameworks/libopencore-amrnb-iphoneos.a file is in the Frameworks directory, but the Swift runtime libraries are the only files permitted in that directory.”

I noticed that the xcframework.sh script for libwebp does something similar, where it creates a fat_a and then packages it into an xcframework, I attempted to package the libwebp xcframework into the project for submission, but it still failed to pass validation.

I checked the .app file, and it seems that all other libraries are packaged as frameworks, but libopencore-amrnb remains as a .a file, which seems to be disallowed.

@EchoLunar
Copy link

I have resolved this issue.

I created an Objective-C Framework using Xcode and included the header and .a files (compiled twice using different .a files for each compile).

I used ‘xcodebuild archive’ to compile the two Frameworks, and then combined them into an xcframework using ‘xcodebuild -create-xcframework’

I tested it on both real devices and simulators, and everything works fine. It has also been successfully uploaded to TestFlight.

However, I completed these steps manually. If you are interested, you might consider further refining this project.

@feuvan
Copy link
Owner

feuvan commented Sep 10, 2024

I have resolved this issue.

I created an Objective-C Framework using Xcode and included the header and .a files (compiled twice using different .a files for each compile).

I used ‘xcodebuild archive’ to compile the two Frameworks, and then combined them into an xcframework using ‘xcodebuild -create-xcframework’

I tested it on both real devices and simulators, and everything works fine. It has also been successfully uploaded to TestFlight.

However, I completed these steps manually. If you are interested, you might consider further refining this project.

Per Apple XCFramework documentation,it should be valid to pass .a with -lib to xcodebuild to create XCFrameworks. I will check this later or maybe just change the way creating XFramework,doing it by combine frameworks.

@DmitryDNKK
Copy link
Author

I confirm the problem and the following solution: according to this, this type of library should have "Do not embed" in the frameworks list and required in Build Phases\Link Binary With Libraries.
Successfully uploaded after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants