43

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

18 Answers 18

90

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

Sign up to request clarification or add additional context in comments.

8 Comments

For me too... but why?
Wow, thank you so much it solved my issue. But it would be better if you shed some light on this fix.
As for why its probably because you're using cocoapods and the pods are only included in the workspace so do not get built when building from the xcodeproj.
For those new to React Native, like me, you can find . xcworkspace at [project_name]/ios/.xcworkspace — Open this in Xcode instead of *.xcodeproj (I spent half an hour confused about xcworkspace vs xcodeproj)
it is very odd ... i had save ios project in xcode and it always works fine.. but now i had to remove this project and add it again and it started to work ... anyway thx
|
19

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

2 Comments

Love the enthusiasm
it stopped working after I added another package and did npm i
8

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

Comments

7

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.

1 Comment

"MyAppName.xcworkspace instead of MyAppName.xcodeproj" : you made my day !
5

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

Comments

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.

Comments

4

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

2 Comments

This answer should be at the top for Apple Silicon chips.
This answer should be at the top
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.

2 Comments

Where can I find DoubleConversion.a to add it?
not sure about the DoubleConversion.a, but DoubleConversion lib it's in node_modules/react-native/third-party
3

I had the same issue, the problem for me, was opening and building project in the wrong place

open ios/{Project}.xcodeproj instead => open ios/{Project}.xcworkspace

Comments

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

2 Comments

@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.
Oh yap, I understand. But you wrote pod rm Podfile.lock. Maybe someone gets lost because of that.
2

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

Comments

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

Comments

1

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

Comments

1

Fix for Apple Silicon M1+ chips:

Podfile


...

  post_install do |installer|

    # FIXES BUILD ON Apple Silicon M1+
    projects = installer.aggregate_targets
      .map{ |t| t.user_project }
      .uniq{ |p| p.path }

    # project.pbxproj
    projects.each do |project|
      project.build_configurations.each do |config|
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end

      project.save()
    end

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

    ...

  end

Comments

0

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

Comments

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.

Comments

0

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

enter image description here

Comments

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.