skip to Main Content

I am getting a build error when using the vision-camera-code-scanner package for my react native project.

The short hand error is:

Undefined symbols for architecture x86_64

The full error is the following:

ld: warning: ignoring file /XXXXXXXXXXXXXXXXXXX/Build/Products/Debug-iphonesimulator/vision-camera-code-scanner/libvision-camera-code-scanner.a, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
Undefined symbols for architecture x86_64:
Undefined symbols for architecture x86_64:
  "_GPBClearOneof", referenced from:
      _MLKITx_EPTFlagValue_ClearValueOneOfCase in MLKitCommon(FlagValues.pbobjc.o)
      _MLKITx_PHENORegistrationInfo_ClearPackageVersionOneOfCase in MLKitCommon(RegistrationInfo.pbobjc.o)
      _MLKITx_PHENORegistrationInfo_ClearApplicationInfoOneOfCase in MLKitCommon(RegistrationInfo.pbobjc.o)
      _MLKITx_CLCCCounter_ClearCounterIdOneOfCase in MLKitCommon(Counters.pbobjc.o)
  "_GULLogBasic", referenced from:
      _MLKLog in MLKitCommon(MLKLogger.o)
  "_OBJC_CLASS_$_GDTCORTransport", referenced from:
      objc-class-ref in MLKitCommon(MLKFirelogTransport.o)
  "_OBJC_CLASS_$_GPBCodedOutputStream", referenced from:
      objc-class-ref in MLKitCommon(CCTLogOutputStream.o)
  "_OBJC_CLASS_$_GPBDescriptor", referenced from:
      objc-class-ref in MLKitCommon(Experiments.pbobjc.o)
      objc-class-ref in MLKitCommon(Metalog.pbobjc.o)
      objc-class-ref in MLKitCommon(FlatFile.pbobjc.o)
      objc-class-ref in MLKitCommon(Clientanalytics.pbobjc.o)
      objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      objc-class-ref in MLKitCommon(UploaderState.pbobjc.o)
      objc-class-ref in MLKitCommon(DeviceExperimentIds.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GPBEnumArray", referenced from:
      objc-class-ref in MLKitBarcodeScanning
      objc-class-ref in MLKitVision(GMVLogger.o)
  "_OBJC_CLASS_$_GPBEnumDescriptor", referenced from:
      objc-class-ref in MLKitCommon(Experiments.pbobjc.o)
      objc-class-ref in MLKitCommon(FlatFile.pbobjc.o)
      objc-class-ref in MLKitCommon(Clientanalytics.pbobjc.o)
      objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      objc-class-ref in MLKitCommon(Barhopper.pbobjc.o)
      objc-class-ref in MLKitCommon(IosAccessibilityState.pbobjc.o)
      objc-class-ref in MLKitCommon(PhenotypeLog.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GPBFileDescriptor", referenced from:
      objc-class-ref in MLKitCommon(Experiments.pbobjc.o)
      objc-class-ref in MLKitCommon(Metalog.pbobjc.o)
      objc-class-ref in MLKitCommon(FlatFile.pbobjc.o)
      objc-class-ref in MLKitCommon(Clientanalytics.pbobjc.o)
      objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      objc-class-ref in MLKitCommon(UploaderState.pbobjc.o)
      objc-class-ref in MLKitCommon(DeviceExperimentIds.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GPBInt32Array", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutLogEvent.o)
  "_OBJC_CLASS_$_GPBMessage", referenced from:
      _OBJC_CLASS_$_MLKITx_EXHParam in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHParam_ExtensionValue in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHDeviceAccount in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHScope in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHParamPartition in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHCrossAppDescriptor in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHConfigurationTier in MLKitCommon(Experiments.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GPBRootObject", referenced from:
      _OBJC_CLASS_$_MLKITx_EXHExperimentsRoot in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_CADPMetalogRoot in MLKitCommon(Metalog.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EPIFlatFileRoot in MLKitCommon(FlatFile.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_CADPClientanalyticsRoot in MLKitCommon(Clientanalytics.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLFirebaseMlSdkRoot in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_CCTUploaderStateRoot in MLKitCommon(UploaderState.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EXHDeviceExperimentIdsRoot in MLKitCommon(DeviceExperimentIds.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GTMLogMininumLevelFilter", referenced from:
      objc-class-ref in MLKitCommon(GIPLoggingReroutingGTMLogger.o)
  "_OBJC_CLASS_$_GTMLogger", referenced from:
      objc-class-ref in MLKitCommon(PHTInternalHeterodyneSyncer.o)
      objc-class-ref in MLKitCommon(PHTHeterodyneSyncer.o)
      objc-class-ref in MLKitCommon(GIPPseudonymousIDStore.o)
      objc-class-ref in MLKitCommon(CCTLogOutputStream.o)
      objc-class-ref in MLKitCommon(CCTClearcutUploader.o)
      objc-class-ref in MLKitCommon(CCTClearcutMetaLogger.o)
      objc-class-ref in MLKitCommon(CCTClearcutFileUtility.o)
      ...
  "_OBJC_CLASS_$_GTMSessionCookieStorage", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutUploader.o)
  "_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutUploader.o)
  "_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
      objc-class-ref in MLKitCommon(PHTFlatFilePhenotype.o)
      objc-class-ref in MLKitCommon(MLKModelDownloader.o)
      objc-class-ref in MLKitVision(GMVCloudVisionClient.o)
  "_OBJC_CLASS_$_GULCCComponent", referenced from:
      objc-class-ref in MLKitCommon(MLKCustomModelManager.o)
  "_OBJC_CLASS_$_GULCCComponentContainer", referenced from:
      objc-class-ref in MLKitCommon(MLKContext.o)
      objc-class-ref in MLKitCommon(MLKCustomModelManager.o)
  "_OBJC_CLASS_$_GULCCComponentType", referenced from:
      objc-class-ref in MLKitCommon(MLKModelManager.o)
      objc-class-ref in MLKitCommon(MLKContext.o)
      objc-class-ref in MLKitCommon(MLKCustomModelManager.o)
  "_OBJC_CLASS_$_GULUserDefaults", referenced from:
      objc-class-ref in MLKitCommon(MLKModelPreferencesManager.o)
      objc-class-ref in MLKitCommon(MLKAnalyticsLogger.o)
      objc-class-ref in MLKitCommon(MLKModelDownloader.o)
  "_OBJC_CLASS_$_RCTBridge", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_METACLASS_$_GPBMessage", referenced from:
      _OBJC_METACLASS_$_MLKITx_EXHParam in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHParam_ExtensionValue in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHDeviceAccount in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHScope in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHParamPartition in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHCrossAppDescriptor in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHConfigurationTier in MLKitCommon(Experiments.pbobjc.o)
      ...
  "_OBJC_METACLASS_$_GPBRootObject", referenced from:
      _OBJC_METACLASS_$_MLKITx_EXHExperimentsRoot in MLKitCommon(Experiments.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_CADPMetalogRoot in MLKitCommon(Metalog.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EPIFlatFileRoot in MLKitCommon(FlatFile.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_CADPClientanalyticsRoot in MLKitCommon(Clientanalytics.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLFirebaseMlSdkRoot in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_CCTUploaderStateRoot in MLKitCommon(UploaderState.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EXHDeviceExperimentIdsRoot in MLKitCommon(DeviceExperimentIds.pbobjc.o)
      ...
  "_OBJC_METACLASS_$_GTMLogger", referenced from:
      _OBJC_METACLASS_$_MLKITx_GIPLoggingReroutingGTMLogger in MLKitCommon(GIPLoggingReroutingGTMLogger.o)
  "_RCTAppSetupDefaultRootView", referenced from:
      -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
  "_RCTAppSetupPrepareApp", referenced from:
      -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
  "_kGTMSessionFetcherStatusDomain", referenced from:
      ___91-[MLKITx_PHTInternalHeterodyneSyncer syncHoldingLockWithSyncedScopes:fetchReason:callback:]_block_invoke in MLKitCommon(PHTInternalHeterodyneSyncer.o)
      ___150-[MLKITx_PHTHeterodyneSyncer batchSyncWithAccounts:syncedScopes:fetchReason:throttlingCache:heterodyneSyncInfo:accountToAuthToken:lastError:callback:]_block_invoke in MLKitCommon(PHTHeterodyneSyncer.o)
      ___69-[MLKModelDownloader beginModelDownloadWithURL:modelInfo:conditions:]_block_invoke.285 in MLKitCommon(MLKModelDownloader.o)
      ___63-[MLKITx_GMVCloudVisionClient initWithCloudUri:apiKey:options:]_block_invoke in MLKitVision(GMVCloudVisionClient.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried to fix the issue by running: pod deintegrate && pod cache clean --all and then pod install in the ios directory as per the following similar question.

Sadly this didnt fix the issue i also tried the steps suggested in the following thread: namely excluding the target arm64. But this also didnt fix the error.

I also read the following on this github thread:

It’s related to the fact that Google MLKit Team does not ship ARM simulator binaries and we can’t compile ourselves because the source code is not public

So now i am a bit lost what to do.
Any help or suggestions greatly appreciated.

Working on mac book pro M1 14 inch
running latest version of react native

If additional information is needed please let me know so i can add it to the question.

2

Answers


  1. As per my findings on this topic, Google MLKit does not support arm64 yet (found it when trying an option to import it through SPM on an iOS project). The only way to build this on an M1 machine is to run the entire project on x86_64 compatiblity using Rosetta 2. However, running Xcode in compatibility mode is not a supported configuration by Apple, so there could be other errors with this choice.

    Login or Signup to reply.
  2. You have to exclude arm64 from your pod file by following these steps:

    1. Add this to your pod file:
    post_install do |installer|
      react_native_post_install(installer)
      installer.pods_project.build_configurations.each do |config|
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      end
    end
    
    1. Make sure to use this flipper version in your pod file:
    use_flipper!({'Flipper' => '0.79.0'})
    
    1. Then, clean your pods and reinstalled them:
    rm -rf ~/Library/Caches/CocoaPods && rm -rf ./ios/Pods && rm -rf ~/Library/Developer/Xcode/DerivedData/* && pod deintegrate && pod setup && npx pod-install
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search