架构 x86_64 颤动的未定义符号

Posted

技术标签:

【中文标题】架构 x86_64 颤动的未定义符号【英文标题】:Undefined symbols for architecture x86_64 flutter 【发布时间】:2020-08-31 11:38:36 【问题描述】:

我正在开发应用程序。 android工作正常,但在ios没有。我需要一些帮助才能在 ios mobile 上运行它。我正在使用 lib:google_maps_flutter:^0.5.27+3firebase_ml_vision:^0.9.3+8。 Xcode 11.4.1 和 Mac os Catalina 10.15.4。有人知道如何解决这个问题。我还没找到。

flutter doctor
[✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.15.4 19E287, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.45.0)
[✓] Connected device (1 available)

• No issues found!

日志错误如下:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GMSPolyline", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapPolylineController.o)
  "_OBJC_CLASS_$_FIRVisionOnDeviceImageLabelerOptions", referenced from:
      objc-class-ref in firebase_ml_vision(ImageLabeler.o)
  "_FIRFaceLandmarkTypeLeftEar", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeMouthLeft", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeRightCheek", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeNoseBase", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeRightEye", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_GMSMarker", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapMarkerController.o)
  "_FIRFaceLandmarkTypeMouthRight", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeLeftEye", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeRightEye", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeLowerLipTop", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_GMSServices", referenced from:
      objc-class-ref in AppDelegate.o
  "_FIRFaceContourTypeNoseBottom", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeLeftCheek", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeLeftEye", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_GMSMapStyle", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapController.o)
  "_FIRFaceContourTypeRightEyebrowTop", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_GMSPolygon", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapPolygonController.o)
  "_FIRFaceContourTypeUpperLipTop", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeRightEyebrowBottom", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeLeftEyebrowBottom", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceLandmarkTypeRightEar", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeUpperLipBottom", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_FIRVisionCloudImageLabelerOptions", referenced from:
      objc-class-ref in firebase_ml_vision(ImageLabeler.o)
  "_OBJC_CLASS_$_GMSCameraPosition", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapController.o)
  "_kGMSMinZoomLevel", referenced from:
      _InterpretMapOptions in google_maps_flutter(GoogleMapController.o)
  "_OBJC_CLASS_$_GMSMapView", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapController.o)
  "_OBJC_CLASS_$_GMSMutablePath", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapPolygonController.o)
      objc-class-ref in google_maps_flutter(GoogleMapPolylineController.o)
  "_OBJC_CLASS_$_GMSCircle", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapCircleController.o)
  "_FIRFaceLandmarkTypeMouthBottom", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_GMSCoordinateBounds", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapController.o)
  "_OBJC_CLASS_$_GMSCameraUpdate", referenced from:
      objc-class-ref in google_maps_flutter(GoogleMapController.o)
  "_FIRFaceContourTypeLeftEyebrowTop", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_FIRVision", referenced from:
      objc-class-ref in firebase_ml_vision(FLTFirebaseMlVisionPlugin.o)
  "_OBJC_CLASS_$_FIRVisionFaceDetectorOptions", referenced from:
      objc-class-ref in firebase_ml_vision(FaceDetector.o)
  "_kGMSMaxZoomLevel", referenced from:
      _InterpretMapOptions in google_maps_flutter(GoogleMapController.o)
  "_FIRFaceContourTypeAll", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_FIRVisionBarcodeDetectorOptions", referenced from:
      objc-class-ref in firebase_ml_vision(BarcodeDetector.o)
  "_OBJC_CLASS_$_FIRApp", referenced from:
      objc-class-ref in firebase_ml_vision(FLTFirebaseMlVisionPlugin.o)
  "_FIRFaceContourTypeLowerLipBottom", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_OBJC_CLASS_$_FIRVisionImage", referenced from:
      objc-class-ref in firebase_ml_vision(FLTFirebaseMlVisionPlugin.o)
  "_FIRFaceContourTypeFace", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
  "_FIRFaceContourTypeNoseBridge", referenced from:
      ___39-[FaceDetector handleDetection:result:]_block_invoke in firebase_ml_vision(FaceDetector.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

【问题讨论】:

物理设备 (iPhone) 有问题吗? 我有 Objective-C Flutter 项目,但尝试使用带有 Swift 代码的插件。用 Swift 重新创建 Flutter 项目为我解决了这个问题 【参考方案1】:

可能错误出在某些XCode项目文件上,试试:

    备份您的项目。

    运行此命令

    扑干净 && \ rm ios/Podfile ios/Podfile.lock pubspec.lock && \ rm -rf ios/Pods ios/Runner.xcworkspace && \ 扑跑

Reference

【讨论】:

我不得不分开运行,但它可以工作。非常感谢:) 完美 - 工作愉快,谢谢。对于 Mac,我使用... flutter clean; rm ios/Podfile ios/Podfile.lock pubspec.lock; rm -rf ios/Pods ios/Runner.xcworkspace; flutter run 对我来说这个答案不起作用。我正在开发一个 Flutter 插件,在我的情况下,解决方案是将 s.static_framework = true 行添加到我插件的 podspec 文件中。希望这可以帮助某人 完美。它有效 这对我也不起作用。【参考方案2】:

这通常是由于现有缓存而导致的依赖关系解析问题。如果您无法为 iOS 构建,无论插件的版本如何,请执行以下步骤。

注意:建议您时不时执行此操作,这样还会占用您机器上的大量已用空间。

    project/ios 文件夹上,运行pod deintegrate && rm Podfile.lock && pod install 在您的项目文件夹中,运行flutter clean 通过运行rm -rf ~/Library/Developer/Xcode/DerivedData 清除 Xcode 派生数据 使用 Xcode 打开项目并通过 Cmd + Shift + K 进行清理 使用flutter build ios 命令构建。

【讨论】:

【参考方案3】:

在带有 m1 芯片的 mac 中,我无法在模拟器中运行我的项目,而是必须使用连接的物理 iPhone,它没有显示错误,运行良好。

【讨论】:

以上是关于架构 x86_64 颤动的未定义符号的主要内容,如果未能解决你的问题,请参考以下文章

Quickblox:架构 x86_64 的未定义符号:错误

GoogleMapsSDK:架构 x86_64 的未定义符号

架构 x86_64 的未定义符号:MqtUtil

Cordova - 架构 x86_64 的未定义符号

切换到调试时架构 x86_64 的未定义符号

GraphicsMagick,架构 x86_64 的未定义符号