26
votes

I tried to build on XCode but ld: library not found for -lDoubleConversion error occurs. I could build react-native run-ios. That would work, but XCode could not build...

ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/DoubleConversion' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/Folly' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/GTMOAuth2' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/GTMSessionFetcher' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/Google-Maps-iOS-Utils' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/Protobuf' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/React' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/glog' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/leveldb-library' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/nanopb' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/react-native-google-maps' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/react-native-maps' ld: warning: directory not found for option '-L/Users/xxxxx/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/yoga' ld: library not found for -lDoubleConversion clang: error: linker command failed with exit code 1 (use -v to see invocation)

14

14 Answers

51
votes

For me, I solved just opening the MyAppName.xcworkspace instead of MyAppName.xcodeproj, and then, building.

12
votes

I had this issue a bit ago after upgrading to RN 0.59.

The solution that worked for me, was to delete the ios/build folder, and then do this:

cd ios

pod install

When I did that, I saw an error about Folly, and people were recommending to do this:

pod deintegrate

pod install

I did that, but it will still throwing the error about Folly, so I deleted the Podfile.lock because pods was holding onto an old version of Folly that was incompatible with RN 0.59.

NOTE: I found a post by someone that said deleting the entire lock file isn't recommended. Instead, you should delete only the relevant lines in the lock file, the lines that pertain to Folly. I had already deleted the lock file, but everything worked out ok.

I ran pod update which updated a bunch of stuff and completed successfully.

The next time I ran pod install, it produced a nice list of green, successful installs.

Then I did react-native run-ios again, and it worked for the first time in a while, except it produced the red screen of death.

So I deleted my app off the iOS simulator device, then ran:

rm -rf node_modules

npm install

killall -9 node

The killall -9 node is just to kill the Metro Bundler. It is my favourite sweeping command for that. If you are running like twelve node.js APIs on your machine, maybe instead do something like sudo lsof -i :8081 and find the process ID for Metro Bundler(s) and kill those by PID. For example if you see Metro Bundler is running as PID 27322, then do kill -9 27322.

Then I ran this in a standalone terminal:

npm start -- --reset-cache

back in the VS Code integrated terminal:

react-native run-ios

IT WORKED !!!!!!!!

Then I ran:

react-native run-android

that worked but got stuck at 0% on the simulator device, so I deleted the APK off the simulator and ran react-native run-android again.

IT WORKED !!!!!!!!

6
votes

It happened to me when building the project on the terminal instead of on XCode, and it happened on both the CI and my laptop.

It happens becase you are building the project app.xcodeproj instead of the workspace app.xcworkspace.

So, you have to change the param in your call, from -project app.xcodeproj to -workspace app.xcworkspace. Note that also the param name changes, not only the value.

And now, a complete call example.

From:

xcodebuild -sdk iphoneos -configuration yourconfig -project app.xcodeproj -scheme yourscheme build -UseModernBuildSystem=YES CODE_SIGN_STYLE=Automatic

To:

xcodebuild -sdk iphoneos -configuration yourconfig -workspace app.xcworkspace -scheme yourscheme build -UseModernBuildSystem=YES CODE_SIGN_STYLE=Automatic

3
votes

XCode can't find the lDoubleConversion library, you need to add the library to the cocoa pods file.

you can do this easily by following these steps

1.Add the library file to your podfile

pod 'DoubleConversion', :podspec => './../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'

2.Delete the Podfile.lock

3.Run pod install

4.Add the DoubleConversion.a in xcode Linked frameworks and libraries

5.Clean the project and build again.

That should works.

2
votes

The following steps worked for me:

  1. Remove use_frameworks! from ios/Podfile.

    target 'AwesomeProject' do
        # use_frameworks!
        ...
    end
    
  2. Add DoubleConversion pod in ios/Podfile

    target 'AwesomeProject' do
        # use_frameworks!
        ...
        pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
    end
    
  3. Clear pods.

    pod deintegrate
    
    pod rm Podfile.lock
    
  4. Reinstall pods

    pod install --repo-update --verbose
    
  5. Open AwesomeProject.xcworkspace and run your app.

Hope this helps someone :)

2
votes

I just update Deployment Target to 11.4 from 10 and its worked

2
votes

use platform :ios, '10.0' instead of platform :ios, '11.0' in Podfile.

1
votes

After doing 3 days of my effort I found the below solutions.

  1. Check you need to open MyAppName.xcworkspace instead of MyAppName.xcodeproj
  2. Close the Xcode and try to Pod deintegrate and then Pod Install
  3. Change build setting from Legacy to New build system.

For me, option 3 worked out.

0
votes

Sometimes it's as easy pod install inside /ios then close xcode and reopen it and rebuild. Worked for me.

0
votes

My problem was that I'd migrated to React Native 0.60 with cocoapods and I'd neglected to update my Fastlane build process to build using the .xcworkspace instead of the .xcproj file.

I narrowed this down by observing that I could build and Archive build using Xcode but my Fastlane build failed. Noob.

0
votes

By activating Find Implicit Dependencies for scheme on xcode solved the problem on my project.

enter image description here

0
votes

For me:

Change the Deployment Target to 11.0, Also change the AppNameTEST Deployment Target to 11.0

rm -rf node_modules

npm install

pod update

pod install
0
votes

I tried everything else for hours, what worked was setting in my Podfile :

platform :ios, '10.0'

The same as the iOS Deployment Target Version in Info.plist. They were different.

0
votes

I'm a bit new to the iOS build process and I will share my solution to hopefully save anyone hours of frustration.

In my case, it was simply a stale/bad build. Make sure you opened the correct Xcode folder in Xcode <YOUR_APP>.xcworkspace, in the top menu of Xcode, select Product -> Clean Build Folder