34

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)

Roc Boronat
  • 11,395
  • 5
  • 47
  • 59
Shun Yamada
  • 879
  • 1
  • 10
  • 25

16 Answers16

63

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

Rafael Motta
  • 2,328
  • 2
  • 19
  • 18
15

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 !!!!!!!!

agm1984
  • 15,500
  • 6
  • 89
  • 113
7

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

Roc Boronat
  • 11,395
  • 5
  • 47
  • 59
5

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

Biswajit Pal
  • 91
  • 1
  • 2
5

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.

yachaka
  • 5,429
  • 1
  • 23
  • 35
4

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.

Bharat Lalwani
  • 1,277
  • 15
  • 17
3

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.

BONEMX
  • 31
  • 2
2

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 :)

Ashwin
  • 7,277
  • 1
  • 48
  • 70
  • @RocBoronat Sure, it just means delete that file. Option '-r' won't be necessary as it is just a file, not a folder; you might require '-f' depending on the permissions on the file and for your user in the system. – Ashwin May 12 '20 at 11:14
  • Oh yap, I understand. But you wrote `pod rm Podfile.lock`. Maybe someone gets lost because of that. – Roc Boronat May 12 '20 at 16:09
2

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

2

Try to check if your project running well on a real ios device because in my case this error was only for builds on simulator because I've got mac with m1 pro chip.

To fix it you need to check "Build Settings" -> "Targets" -> "Architectures" -> "Excluded Architectures" and verify that arm64 NOT excluded from the project, if it excluded you should remove it for running simulator on m1 chip. enter image description here

Kirill Kohan
  • 181
  • 1
  • 2
  • 5
1

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

Kelvin
  • 629
  • 7
  • 8
0

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

Dina Nashaat
  • 27
  • 1
  • 8
0

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.

Karl von Randow
  • 474
  • 3
  • 13
0

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

enter image description here

asukiaaa
  • 1,594
  • 17
  • 19
0

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

For me, I solved by adding the following code at the end of the Podfile

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

This solution will work for Apple mac M2 and macOS Ventura. Thanks !!

Rahul Mankar
  • 114
  • 1
  • 11