2 Replies
      Latest reply on Feb 21, 2020 11:05 AM by LFuryk
      LFuryk Level 1 Level 1 (0 points)

        Xcode (11.3.1) is having issues to found x86_64 architecture symbols while using XCFrameworks. The problem is that the architecture is inside the XCFramework, but first let me show you how the framework was created.


        To generate the XCFramework I made two Archives:

        1. For iOS:
          xcodebuild archive -scheme MyPod -target MyPod -destination="iOS" -archivePath build/ios.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
        2. For iOS Simulator:
          xcodebuild archive -scheme MyPod -target MyPod -destination="iOS Simulator" -archivePath build/iossimulator.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES


        Then I generated the XCFramework:
             xcodebuild -create-xcframework -framework      ./build/ios.xcarchive/Products/Library/Frameworks/MyPod.framework -framework      ./build/iossimulator.xcarchive/Products/Library/Frameworks/MyPod.framework -output      xcframework/MyPod.xcframework


        Here is the XCFramework created where we can see the two architectures: XCFramework preview


        Once it was created, I distributed it by Cocoapods (1.9.0.beta.3). So my .podspec looks like:


             s.subspec "Vendored" do |framework|

                  framework.vendored_framework = 'xcframework/MyPod.xcframework'



        Then I consumed it in another project, and when compiling, it fails because it can't find the architecture for the simulator (on devices it works)

        The log I got is the following:


        ld: warning: ignoring file /Path/To/MyProject/Pods/MyPod/xcframework/MyPod.xcframework/ios-armv7_arm64/MyPod.framework/MyPod, missing required architecture x86_64 in file /Path/To/MyProject/Pods/MyPod/xcframework/MyPod.xcframework/ios-armv7_arm64/MyPod.framework/MyPod (2 slices) Undefined symbols for architecture x86_64: "_OBJC_CLASS_$MyPod", referenced from: objc-class-ref in SomeClass.o ld: symbol(s) not found for architecture x86_64


        It looks like xcodebuild always go to the ios-armv7_arm64 folder instead the ios-i386_x86_64-simulator one, any ideas?


        Thank you!