React-native-mapbox-gl: Linker command failed with exit code 1 (use -v to see invocation)

Created on 3 Mar 2016  路  13Comments  路  Source: nitaliano/react-native-mapbox-gl

Hello - I searched the issues here as well as in stackOverflow, but cannot seem to find a resolution to this problem.

I followed the _manual_ instructions - https://github.com/mapbox/react-native-mapbox-gl/blob/master/ios/install.md - to install react-native-mapbox-gl for iOS, installing manually onto my Macbook Pro and I am using_ xCode 7.2.x_ .

I am getting an error in xCode and the project fails to build with the following error :

ld: framework not found Mapbox
clang: error: linker command failed with exit code 1 (use -v to see invocation)

xCode is executing the following command:

Ld /Users/edward/Library/Developer/Xcode/DerivedData/rnp3-bmfxgzpqxxodcqfrgjyuxbsnajtz/Build/Products/Debug-iphonesimulator/rnp3.app/rnp3 normal i386

    cd /Users/edward/gitRepo/someProject/ios

    export IPHONEOS_DEPLOYMENT_TARGET=8.0

    export PATH="(extremely long path statement)"

-v

general details -
*running react-native 0.2x (latest)
*used node 4.x stable to install react-native-mapbox-gl via npm
*Also changed the deployment target from iOS 7.x to 8.x and 9.x in xCode and still get the same results.

initial thought - do I have to add some file or folder to path? let me know.

Any help is appreciated. thanks - Edward

ios support

Most helpful comment

I added following entry to Build Settings -> Framework Search Paths (Debug and Release) and it solved the problem on my machine:
$(PROJECT_DIR)/../node_modules/react-native-mapbox-gl (recursive)

screenshotmapbox

All 13 comments

Any chance you could post a screenshot of your Xcode setup? Can you verify you added the Mapbox framework in the embedded framework section?

@bsudekum thanks for responding. I will post a screenshot of xCode setup in a moment but yes I embedded the Mapbox framework in the embedded framework settings under the General Tab for my project.

In the meantime, I thought I would follow up with the following:

1) looks like the process for creating Android version works (I was able to implement the example)
2) I also attempted the cocoapods install. Got a similar linker error -

ld: library not found for -lPods-{projectName} clang: error: linker command failed with exit code 1 (use -v to see invocation)

(even going further as to add the additional references to my podfile as you described further on in the iOS instructions and updating the node_modules references appropriately, this executed with no errors)
`
source 'https://github.com/CocoaPods/Specs.git'

xcodeproj 'projectName'
workspace 'projectName'

pod 'RCTMapboxGL', :path => '../node_modules/react-native-mapbox-gl/ios'
pod 'React', :path => '../node_modules/react-native'
pod 'React/RCTGeolocation', :path => '../node_modules/react-native'
pod 'React/RCTImage', :path => '../node_modules/react-native'
pod 'React/RCTNetwork', :path => '../node_modules/react-native'
pod 'React/RCTText', :path => '../node_modules/react-native'
pod 'React/RCTWebSocket', :path => '../node_modules/react-native'
`

So having tried both methods on two mac machines I am currently stuck.

Here is the general order of steps I performed in image form as per your request @bsudekum

  1. install at command prompt
    mb001_install
  2. add to project
    mb002_setup
  3. embed in general tab
    mb003_embedbinary_ingeneral
  4. add run script in build phase
    mb004_addbashscript
  5. add framework/library
    mb005_addlibrctmapbox
  6. result of adding framework/library
    mb006_addlinkbinary

I then implemented the example and built the project in Xcode.

Here was the result (from one of a number of multiple tests) @bsudekum ...

screen shot 2016-03-07 at 3 51 56 pm

specs:
*xCode 7.2.1
*simulator was set up as iphone5 / iOS 8.1,9.1,9.2 or iPhone 6s iOS 8.1,9.1,9.2
*fresh install for examples: npm / nvm, node 4.x, react-native 0.20 (they have since upgraded to 0.21)
*I am the admin of my machine with root access (if required)

I also ran the setup against cocoa pods (latest version) and had the native version of Ruby for OSX (I think 2.x) then upgraded to the latest version for OSX.

_notes: in a test I performed today (March 7th, over a week later) I was able to get the example iOS app running by launching the site from the _terminal* using the commandreact-native run-ios !!! but not in xCode on two different machines??
** I also noted that the manual instructions for iOS do not necessarily match the images provided , had to infer whether to add "bash" to the run script command for example, or when you right-click on your project to add files, do you add the RCTMapbox.xpcodeproj to the root of your project or in the libraries folder? - The choice you make determines whether xCode finds Mapbox.framework easily or not when you embed it in the general tab and it _may_ be the cause of some issues (xCode might not find it on building the project and the icon indicates its 'missing')

mb007_gotittoworkatcommandprompt

I'm getting the same issue. Been following the guide for adding to Xcode manually, but getting the
framework not found Mapbox when trying to build the application.

My problem was that I initially did one of the steps wrong (added a library to the wrong path), and no matter if I fixed it it was broken.
Had to recreate the whole project, then it worked fine.

@frankbolviken so even just removing and re-adding the correct library and its path did not work for you? re-creating the entire project? strange, I will try.

@edward-at-intelex did you solve this problem?

I am experiencing the same issue. I have followed the guide exactly but still receive the error

ld: framework not found Mapbox
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I added following entry to Build Settings -> Framework Search Paths (Debug and Release) and it solved the problem on my machine:
$(PROJECT_DIR)/../node_modules/react-native-mapbox-gl (recursive)

screenshotmapbox

Any update on this, I seem to be getting the same error framework not found Mapbox

Most recent post https://github.com/mapbox/react-native-mapbox-gl/pull/741

Seem to have tried many approaches, both via CocoaPods and Manual installation ... neither is currently working for me.

When doing CocoaPods, I get framework not found Mapbox, when doing manual install I get issues such as framework not found XCTest

After removing the project, cloning again, running npm install, and jscodeshift -t react-codemod/transforms/React-PropTypes-to-prop-types.js clustr_app/node_modules/ on my project node modules, I then get the following after the app starts up which is libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Thanks very much

I have the same problem, my installation used to work, then I followed this procedure to add facebook login support and I think it broke something but I don't know what.

I was able to solve it with @dmiskiew's fix, but had a slightly different URL due to installing mapbox-gl from the scoped package:

$(PROJECT_DIR)/../node_modules/@mapbox/react-native-mapbox-gl
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lernerbot picture lernerbot  路  3Comments

Gp2mv3 picture Gp2mv3  路  3Comments

igor9silva picture igor9silva  路  3Comments

EugenePisotsky picture EugenePisotsky  路  4Comments

olofd picture olofd  路  3Comments