6

I have this error

❌  ld: library not found for -lDoubleConversion

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


error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening App.xcworkspace

** BUILD FAILED **

The following build commands failed:
    Ld /Users/mohamedelmi/workspace/elmi/food-frontend/ios/build/App/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/x86_64/App normal x86_64
(1 failure)

here is what i did

  1. I clean and rebuild still have the error
  2. rm -f ~/Library/Developer/Xcode/DerivedData/ModuleCach
Mohamed Elmi Hassan
  • 321
  • 1
  • 3
  • 12

4 Answers4

6

First of all, make sure that Libraries -> React.xcodeproj -> ThirdParty -> double-conversion exists and a static library is being produced from it, like this:

enter image description here

Then, if are you're using cocoapods, make sure to add DoubleConversion to your Podfile:

target 'MyApp' do
  pod 'React', :path => "../node_modules/react-native", :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    # the following ones are the ones taken from "Libraries" in Xcode:
    'RCTAnimation',
    'RCTActionSheet',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]
  pod 'yoga', :path => "../node_modules/react-native/ReactCommon/yoga"

  # Here it goes
  pod 'DoubleConversion', :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"

  pod 'glog', :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec"
end

And finally, if none of this worked so far, there's a script you can manually run in order to resolve React's third-party dependencies.

Just go to node_modules/react-native and type:

$ ./scripts/ios-install-third-party.sh

Important: Always run it inside node_modules/react-native. Because, as far as I know, the script uses relative paths in order to store third-party's source code and react native will always look for it at node_modules/react-native/third-party. So just make sure to run it in the right place.

Note: This script is, probably, already running as a build phase on your project.

Murilo Paixão
  • 576
  • 2
  • 6
  • 3
    I have the same issue with DoubleConversion. I did all steps as you told but build still failed with error: Library not found for -lDoubleConversion. Any ideas? – toombeos May 07 '19 at 16:40
  • This answer does not take into account the case where the failure described occurs only in release builds, not debug builds. – Kendall Helmstetter Gelner May 11 '20 at 22:09
  • am also facing the same issue when i select any iosdevice(arm64,armv).but when i select my device its working.any solution? – Khushi Mar 30 '21 at 11:54
0

I followed the answers on Why linker link static libraries with errors? iOS but nothing worked for me since I was combining the answers.

I got it to work by ONLY doing the "create new Swift-file"-trick. So remove everything, do a fresh install and only add a new Swift-file that will create the Bridging Header (dont delete the Swift-file).

willedanielsson
  • 1,333
  • 3
  • 11
  • 14
0

This is what finally worked for me. (Before proceeding, make sure pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' is included in your podfiles

1. cd ios
2. Delete Podfile.lock
3. pod deintegrate
4. pod install
5. cd ..
6. rm -rf node_modules && yarn
7. Add use_frameworks! to your Podfile

Run react-native-run-ios or Build with Xcode by opening the xcworkspace file in your ios directory.

Gianfranco P.
  • 10,049
  • 6
  • 51
  • 68
Ayelegun Kayode
  • 489
  • 3
  • 3
0

This is what finally worked for me.

pod deintegrate

pod install

Open project in X-Code

Remove Resources folder from left sidebar

Build your project from New Build System.

osama somy
  • 385
  • 5
  • 16