react-native-vision-camera: 🐛 Errors when building for simulator, works fine on devices

What were you trying to do?

I’m trying to build my react-native application, it works on devices, but when I try to build on the simulator, it gives me plenty of errors, I’ve already tried the solutions in the troubleshooting guide, didn’t change much.

Reproduceable Code

No response

What happened instead?

When selecting “any iOS Device arm64” it builds without issues, and I can create the IPA file and test on TestFlight, but when trying to test on simulator, regardless of version, it gives me a collection of erros, usually around the MLKIT components and:

Showing Recent Messages Undefined symbol: _GULLogBasic Undefined symbol: OBJC_CLASS$_GPBEnumArray Undefined symbol: _GPBClearOneof Undefined symbol: OBJC_CLASS$_GTMLogMininumLevelFilter Undefined symbol: OBJC_METACLASS$_GTMLogger Undefined symbol: OBJC_CLASS$_GPBCodedOutputStream Undefined symbol: OBJC_CLASS$_GPBFileDescriptor Undefined symbol: OBJC_CLASS$_GPBEnumDescriptor Undefined symbol: OBJC_CLASS$_GPBDescriptor Undefined symbol: _kGTMSessionFetcherStatusDomain Undefined symbol: OBJC_CLASS$_GDTCORTransport Undefined symbol: OBJC_CLASS$_GTMSessionFetcherService Undefined symbol: OBJC_CLASS$_GTMSessionFetcher Undefined symbol: OBJC_METACLASS$_GPBMessage Undefined symbol: OBJC_CLASS$_GTMLogger Undefined symbol: OBJC_CLASS$_FlipperClient Undefined symbol: OBJC_METACLASS$_GPBRootObject Undefined symbol: OBJC_CLASS$_GULCCComponentContainer Undefined symbol: OBJC_CLASS$_GULCCComponentType Undefined symbol: OBJC_CLASS$_GPBMessage Undefined symbol: OBJC_CLASS$_GULUserDefaults Undefined symbol: OBJC_CLASS$_FlipperKitNetworkPlugin Undefined symbol: OBJC_CLASS$_GPBRootObject Undefined symbol: OBJC_CLASS$_RCTBundleURLProvider Undefined symbol: OBJC_CLASS$_SKIOSNetworkAdapter Undefined symbol: OBJC_CLASS$_FlipperKitReactPlugin Undefined symbol: OBJC_CLASS$_SKDescriptorMapper Undefined symbol: OBJC_CLASS$_GPBInt32Array Undefined symbol: OBJC_CLASS$_GTMSessionCookieStorage Undefined symbol: OBJC_CLASS$_FlipperKitLayoutPlugin Undefined symbol: OBJC_CLASS$_FKUserDefaultsPlugin Undefined symbol: OBJC_CLASS$_GULCCComponent Undefined symbol: OBJC_CLASS$_RCTRootView Undefined symbol: OBJC_CLASS$_RCTBridge

Relevant log output

Undefined symbols for architecture x86_64:
  "_GULLogBasic", referenced from:
      _MLKLog in MLKitCommon(MLKLogger.o)
  "_OBJC_CLASS_$_GPBEnumArray", referenced from:
      objc-class-ref in MLKitVision(GMVLogger.o)
  "_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)
  "_OBJC_CLASS_$_GTMLogMininumLevelFilter", referenced from:
      objc-class-ref in MLKitCommon(GIPLoggingReroutingGTMLogger.o)
  "_OBJC_METACLASS_$_GTMLogger", referenced from:
      _OBJC_METACLASS_$_MLKITx_GIPLoggingReroutingGTMLogger in MLKitCommon(GIPLoggingReroutingGTMLogger.o)
  "_OBJC_CLASS_$_GPBCodedOutputStream", referenced from:
      objc-class-ref in MLKitCommon(CCTLogOutputStream.o)
  "_OBJC_CLASS_$_GPBFileDescriptor", referenced from:
      objc-class-ref in MLKitCommon(Enums.pbobjc.o)
      objc-class-ref in MLKitCommon(UploaderState.pbobjc.o)
      objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      objc-class-ref in MLKitCommon(Barhopper.pbobjc.o)
      objc-class-ref in MLKitCommon(FlatFile.pbobjc.o)
      objc-class-ref in MLKitCommon(TypedFeatures.pbobjc.o)
      objc-class-ref in MLKitCommon(PhenotypeLog.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GPBEnumDescriptor", referenced from:
      objc-class-ref in MLKitCommon(Enums.pbobjc.o)
      objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      objc-class-ref in MLKitCommon(Barhopper.pbobjc.o)
      objc-class-ref in MLKitCommon(FlatFile.pbobjc.o)
      objc-class-ref in MLKitCommon(PhenotypeLog.pbobjc.o)
      objc-class-ref in MLKitCommon(Clientanalytics.pbobjc.o)
      objc-class-ref in MLKitCommon(VisionExtension.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GPBDescriptor", referenced from:
      objc-class-ref in MLKitCommon(Enums.pbobjc.o)
      objc-class-ref in MLKitCommon(UploaderState.pbobjc.o)
      objc-class-ref in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      objc-class-ref in MLKitCommon(Barhopper.pbobjc.o)
      objc-class-ref in MLKitCommon(FlatFile.pbobjc.o)
      objc-class-ref in MLKitCommon(TypedFeatures.pbobjc.o)
      objc-class-ref in MLKitCommon(PhenotypeLog.pbobjc.o)
      ...
  "_kGTMSessionFetcherStatusDomain", referenced from:
      ___69-[MLKModelDownloader beginModelDownloadWithURL:modelInfo:conditions:]_block_invoke.285 in MLKitCommon(MLKModelDownloader.o)
      ___91-[MLKITx_PHTInternalHeterodyneSyncer syncHoldingLockWithSyncedScopes:fetchReason:callback:]_block_invoke_2 in MLKitCommon(PHTInternalHeterodyneSyncer.o)
      ___150-[MLKITx_PHTHeterodyneSyncer batchSyncWithAccounts:syncedScopes:fetchReason:throttlingCache:heterodyneSyncInfo:accountToAuthToken:lastError:callback:]_block_invoke_2 in MLKitCommon(PHTHeterodyneSyncer.o)
      ___63-[MLKITx_GMVCloudVisionClient initWithCloudUri:apiKey:options:]_block_invoke in MLKitVision(GMVCloudVisionClient.o)
  "_OBJC_CLASS_$_GDTCORTransport", referenced from:
      objc-class-ref in MLKitCommon(MLKFirelogTransport.o)
  "_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
      objc-class-ref in MLKitCommon(MLKModelDownloader.o)
      objc-class-ref in MLKitVision(GMVCloudVisionClient.o)
  "_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutUploader.o)
      objc-class-ref in MLKitCommon(PHTInternalHeterodyneSyncer.o)
      objc-class-ref in MLKitCommon(PHTHeterodyneSyncer.o)
  "_OBJC_METACLASS_$_GPBMessage", referenced from:
      _OBJC_METACLASS_$_MLKITx_EXHFetchReason in MLKitCommon(Enums.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_CCTUploaderState in MLKitCommon(UploaderState.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLSystemInfo in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLModelInfo in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLOtherError in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLImageInfo in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLInferenceCommonLogEvent in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GTMLogger", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutUploader.o)
      objc-class-ref in MLKitCommon(CCTClearcutMetaLogger.o)
      objc-class-ref in MLKitCommon(PHTFlatFilePhenotype.o)
      objc-class-ref in MLKitCommon(PHTURL.o)
      objc-class-ref in MLKitCommon(CCTLogWriter.o)
      objc-class-ref in MLKitCommon(CCTLogOutputStream.o)
      objc-class-ref in MLKitCommon(CCTClearcutFileUtility.o)
      ...
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_METACLASS_$_GPBRootObject", referenced from:
      _OBJC_METACLASS_$_MLKITx_EXHEnumsRoot in MLKitCommon(Enums.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_CCTUploaderStateRoot in MLKitCommon(UploaderState.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_FBMLFirebaseMlSdkRoot in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_BARBarhopperRoot in MLKitCommon(Barhopper.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_EPIFlatFileRoot in MLKitCommon(FlatFile.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_TypedFeaturesRoot in MLKitCommon(TypedFeatures.pbobjc.o)
      _OBJC_METACLASS_$_MLKITx_PHTPhenotypeLogRoot in MLKitCommon(PhenotypeLog.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GULCCComponentContainer", referenced from:
      objc-class-ref in MLKitCommon(MLKContext.o)
      objc-class-ref in MLKitCommon(MLKCustomModelManager.o)
      objc-class-ref in MLKitImageLabeling
  "_OBJC_CLASS_$_GULCCComponentType", referenced from:
      objc-class-ref in MLKitCommon(MLKContext.o)
      objc-class-ref in MLKitCommon(MLKCustomModelManager.o)
      objc-class-ref in MLKitCommon(MLKModelManager.o)
      objc-class-ref in MLKitImageLabelingCommon(MLKImageLabeler.o)
      objc-class-ref in MLKitObjectDetectionCommon(MLKObjectDetector.o)
  "_OBJC_CLASS_$_GPBMessage", referenced from:
      _OBJC_CLASS_$_MLKITx_EXHFetchReason in MLKitCommon(Enums.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_CCTUploaderState in MLKitCommon(UploaderState.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLSystemInfo in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLModelInfo in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLOtherError in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLImageInfo in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLInferenceCommonLogEvent in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      ...
  "_OBJC_CLASS_$_GULUserDefaults", referenced from:
      objc-class-ref in MLKitCommon(MLKAnalyticsLogger.o)
      objc-class-ref in MLKitCommon(MLKModelDownloader.o)
      objc-class-ref in MLKitCommon(MLKModelPreferencesManager.o)
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GPBRootObject", referenced from:
      _OBJC_CLASS_$_MLKITx_EXHEnumsRoot in MLKitCommon(Enums.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_CCTUploaderStateRoot in MLKitCommon(UploaderState.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_FBMLFirebaseMlSdkRoot in MLKitCommon(FirebaseMlSdk.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_BARBarhopperRoot in MLKitCommon(Barhopper.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_EPIFlatFileRoot in MLKitCommon(FlatFile.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_TypedFeaturesRoot in MLKitCommon(TypedFeatures.pbobjc.o)
      _OBJC_CLASS_$_MLKITx_PHTPhenotypeLogRoot in MLKitCommon(PhenotypeLog.pbobjc.o)
      ...
  "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKIOSNetworkAdapter", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GPBInt32Array", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutLogEvent.o)
  "_OBJC_CLASS_$_GTMSessionCookieStorage", referenced from:
      objc-class-ref in MLKitCommon(CCTClearcutUploader.o)
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GULCCComponent", referenced from:
      objc-class-ref in MLKitCommon(MLKCustomModelManager.o)
      objc-class-ref in MLKitImageLabeling
  "_OBJC_CLASS_$_RCTRootView", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBridge", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Device

iPhone 11 (15) Xcode Simulator

VisionCamera Version

2.12.2

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (2 by maintainers)

Most upvoted comments

This issue is already closed. But I had exactly the same problem and found a solution for it. So maybe it will help somebody in the future, if I share it here:

The build failed only in projects when using the frame processor “react-native-vision-camera”.

When I experienced this issue I developed on an MBP with M1Max Apple Silicon running macOS Monterey and XCode 13.3. I wanted to give it another try with a different macOS / XCode version and did a checkout on my old 2017 Intel based MBP: And everything worked fine. Then I updated my old Intel based MBP to the same versions of node / macOS / XCode and the builds still ran sucessfully.

It seems that the only issue is the hardware platform. Even when working with Rosetta.

So here is a fix that worked on my Apple silicon MPB: Make sure that you add “arm64” as “Excluded Architecture” to your project AND the pod configuration:

Bildschirmfoto 2022-04-07 um 11 23 07

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
    end
  end
end

This is happening to me to:

macbook air m2 xcode 14.1 RN 0.69.7

The workaround on my podfile is to exclude arm64 compilation:

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    
    installer.pods_project.targets.each do |target|
      # Prevents dependencies to be compiled under m1
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
        end
      end

      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
            config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

So I’m aware already that the problem was the new chip and all the headache that comes with it, this solution, where you put the “arm64” at excluded architectures, solves a lot of different issues i’ve been having, in a lot of different libs, but, in this particular case, it didn’t, still, glad to know it worked for you.