Apple M1 xcode build fails

@zhangxm, @Rusty
I tried with cocos2d-x versions 3.16, 3.17 to create .xcframework bundle so that i can use arm64 iPhone Simulator.

Unfortunately generated static libs(.a) not allowing me to create .xcframework with the below error:
error: binaries with multiple platforms are not supported ‘/Users/…/Library/Developer/Xcode/DerivedData/cocos2d_libs-dblupjckulxzszdihupnxykfhiaq/Build/Products/Release-iphonesimulator/libcocos2d_iOS.a’

After analyzing the .a file using "otool -l -arch arm64 libcocos2d_iOS.a " came to know for some of the object files (.o ) its creating arm64 iPhone platform not for iPhoneSimulator.

Can anyone help me on this?

@zhangxm @Rusty

I was able to build and generate arm64 static libs for iPhone simulator, but getting below error at runtime.

“ld: in /Users/…/Documents/Workspace/…/iOS/DerivedData/XCFramework/Build/Products/Release-iphonesimulator/libcocos2d_iOS.a(btAxisSweep3.o), building for iOS Simulator, but linking in object file built for iOS, file ‘/Users/…/Documents/Workspace/…/iOS/DerivedData/XCFramework/Build/Products/Release-iphonesimulator/libcocos2d_iOS.a’ for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)”

You have to exclude the arm64 architecture in Simulator build.
Build Settings > Excluded Architectures > Any iOS Simulator SDK > arm64

Has anyone got their build to work on M1 mac arm64 simulator ? if so could you please help me or point me in the right direction