nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

ld: symbol(s) not found for architecture x86_64 for Xcode10 #1424

Closed giantss closed 5 years ago

giantss commented 5 years ago

step

  1. create a new project.
  2. yarn add @mapbox/react-native-mapbox-gl
  3. react-native link
  4. react-native run-ios

error info:

d: warning: Could not find auto-linked framework 'Mapbox'
Undefined symbols for architecture x86_64:
  "_MGLOfflinePackErrorNotification", referenced from:

      -[MGLOfflineModule init] in libRCTMGL.a(MGLOfflineModule.o)

  "_MGLOfflinePackMaximumMapboxTilesReachedNotification", referenced from:

      -[MGLOfflineModule init] in libRCTMGL.a(MGLOfflineModule.o)

  "_MGLOfflinePackProgressChangedNotification", referenced from:

      -[MGLOfflineModule init] in libRCTMGL.a(MGLOfflineModule.o)

  "_MGLOfflinePackUserInfoKeyError", referenced from:

      -[MGLOfflineModule offlinePackDidReceiveError:] in libRCTMGL.a(MGLOfflineModule.o)

  "_MGLShapeSourceOptionBuffer", referenced from:

      -[RCTMGLShapeSource _getOptions] in libRCTMGL.a(RCTMGLShapeSource.o)

  "_MGLShapeSourceOptionClusterRadius", referenced from:

      -[RCTMGLShapeSource _getOptions] in libRCTMGL.a(RCTMGLShapeSource.o)

  "_MGLShapeSourceOptionClustered", referenced from:

      -[RCTMGLShapeSource _getOptions] in libRCTMGL.a(RCTMGLShapeSource.o)

  "_MGLShapeSourceOptionMaximumZoomLevel", referenced from:

      -[RCTMGLShapeSource _getOptions] in libRCTMGL.a(RCTMGLShapeSource.o)

  "_MGLShapeSourceOptionMaximumZoomLevelForClustering", referenced from:

      -[RCTMGLShapeSource _getOptions] in libRCTMGL.a(RCTMGLShapeSource.o)

  "_MGLShapeSourceOptionSimplificationTolerance", referenced from:

      -[RCTMGLShapeSource _getOptions] in libRCTMGL.a(RCTMGLShapeSource.o)

  "_MGLTileSourceOptionAttributionHTMLString", referenced from:

      -[RCTMGLRasterSource _getOptions] in libRCTMGL.a(RCTMGLRasterSource.o)

  "_MGLTileSourceOptionMaximumZoomLevel", referenced from:

      -[RCTMGLRasterSource _getOptions] in libRCTMGL.a(RCTMGLRasterSource.o)

  "_MGLTileSourceOptionMinimumZoomLevel", referenced from:

      -[RCTMGLRasterSource _getOptions] in libRCTMGL.a(RCTMGLRasterSource.o)

  "_MGLTileSourceOptionTileCoordinateSystem", referenced from:

      -[RCTMGLRasterSource _getOptions] in libRCTMGL.a(RCTMGLRasterSource.o)

  "_MGLTileSourceOptionTileSize", referenced from:

      -[RCTMGLRasterSource _getOptions] in libRCTMGL.a(RCTMGLRasterSource.o)

  "_OBJC_CLASS_$_MGLAccountManager", referenced from:

      objc-class-ref in libRCTMGL.a(MGLModule.o)

  "_OBJC_CLASS_$_MGLAnnotationView", referenced from:

      _OBJC_CLASS_$_RCTMGLPointAnnotation in libRCTMGL.a(RCTMGLPointAnnotation.o)

  "_OBJC_CLASS_$_MGLBackgroundStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLBackgroundLayer.o)

  "_OBJC_CLASS_$_MGLCircleStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLCircleLayer.o)

  "_OBJC_CLASS_$_MGLFillExtrusionStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLFillExtrusionLayer.o)

  "_OBJC_CLASS_$_MGLFillStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLFillLayer.o)

  "_OBJC_CLASS_$_MGLImageSource", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLImageSource.o)

  "_OBJC_CLASS_$_MGLLight", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLLight.o)

  "_OBJC_CLASS_$_MGLLineStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLLineLayer.o)

  "_OBJC_CLASS_$_MGLMapCamera", referenced from:

      objc-class-ref in libRCTMGL.a(MGLSnapshotModule.o)

  "_OBJC_CLASS_$_MGLMapSnapshotOptions", referenced from:

      objc-class-ref in libRCTMGL.a(MGLSnapshotModule.o)

  "_OBJC_CLASS_$_MGLMapSnapshotter", referenced from:

      objc-class-ref in libRCTMGL.a(MGLSnapshotModule.o)

  "_OBJC_CLASS_$_MGLMapView", referenced from:

      _OBJC_CLASS_$_RCTMGLMapView in libRCTMGL.a(RCTMGLMapView.o)

  "_OBJC_CLASS_$_MGLOfflineStorage", referenced from:

      objc-class-ref in libRCTMGL.a(MGLOfflineModule.o)

  "_OBJC_CLASS_$_MGLPointFeature", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLMapViewManager.o)
      objc-class-ref in libRCTMGL.a(RCTMGLMapTouchEvent.o)

  "_OBJC_CLASS_$_MGLRasterSource", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLRasterSource.o)

  "_OBJC_CLASS_$_MGLRasterStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLRasterLayer.o)

  "_OBJC_CLASS_$_MGLShape", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLUtils.o)

  "_OBJC_CLASS_$_MGLShapeCollectionFeature", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLUtils.o)

  "_OBJC_CLASS_$_MGLShapeSource", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLShapeSource.o)

  "_OBJC_CLASS_$_MGLStyle", referenced from:

      objc-class-ref in libRCTMGL.a(MGLModule.o)

  "_OBJC_CLASS_$_MGLStyleValue", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLStyleValue.o)

  "_OBJC_CLASS_$_MGLSymbolStyleLayer", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLSymbolLayer.o)

  "_OBJC_CLASS_$_MGLTilePyramidOfflineRegion", referenced from:

      objc-class-ref in libRCTMGL.a(MGLOfflineModule.o)

  "_OBJC_CLASS_$_MGLUserLocation", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLMapViewManager.o)

     (maybe you meant: _OBJC_CLASS_$_MGLUserLocationHeadingArrowLayer

, _OBJC_CLASS_$_MGLUserLocationHeadingBeamLayer 

)
  "_OBJC_CLASS_$_MGLUserLocationAnnotationView", referenced from:

      _OBJC_CLASS_$_MGLFaux3DUserLocationAnnotationView in libRCTMGL.a(MGLFaux3DUserLocationAnnotationView.o)

  "_OBJC_CLASS_$_MGLVectorSource", referenced from:

      objc-class-ref in libRCTMGL.a(RCTMGLVectorSource.o)

  "_OBJC_METACLASS_$_MGLAnnotationView", referenced from:

      _OBJC_METACLASS_$_RCTMGLPointAnnotation in libRCTMGL.a(RCTMGLPointAnnotation.o)

  "_OBJC_METACLASS_$_MGLMapView", referenced from:

      _OBJC_METACLASS_$_RCTMGLMapView in libRCTMGL.a(RCTMGLMapView.o)

  "_OBJC_METACLASS_$_MGLUserLocationAnnotationView", referenced from:

      _OBJC_METACLASS_$_MGLFaux3DUserLocationAnnotationView in libRCTMGL.a(MGLFaux3DUserLocationAnnotationView.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

The following commands produced analyzer issues:
        Analyze /Users/zhongpeng/file/code/react-native/test/MapboxTest/node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64

        Analyze /Users/zhongpeng/file/code/react-native/test/MapboxTest/node_modules/react-native/Libraries/Image/RCTImageCache.m normal x86_64
        Analyze /Users/zhongpeng/file/code/react-native/test/MapboxTest/node_modules/react-native/Libraries/Network/RCTNetInfo.m normal x86_64
(3 commands with analyzer issues)

The following build commands failed:
        Ld /Users/zhongpeng/file/code/react-native/test/MapboxTest/ios/build/Build/Products/Debug-iphonesimulator/MapboxTest.app/MapboxTest normal x86_64
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/MapboxTest.app
An error was encountered processing the command (domain=IXErrorDomain, code=13):
Failed to get bundle ID from /Users/zhongpeng/file/code/react-native/test/MapboxTest/ios/build/Build/Products/Debug-iphonesimulator/MapboxTest.app
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/MapboxTest.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/MapboxTest.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:611:11)
    at Object.execFileSync (child_process.js:629:13)
    at Promise.then (/Users/zhongpeng/file/code/react-native/test/MapboxTest/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)

environment

{
  "name": "MapboxTest",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    "react": "16.6.1",
    "react-native": "0.57.5"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.49.2",
    "react-test-renderer": "16.6.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
giantss commented 5 years ago

I tried to fix it.

add $(SRCROOT)/../node_modules/@mapbox/react-native-mapbox-gl/ios to Framework Search Paths

image

Then I tried to run the project, build success.But just running, the program crashes.

image

I have solved this problem here #1402.

In fact, I can't understand very much. After using the react-native link, I need to manually complete the above operation. 😿

kristfal commented 5 years ago

React native link is not fully supported. Please follow manual install instructions. It may also help to install from master.