Shun Yamada
Shun Yamada

Reputation: 979

library not found for -lDoubleConversion

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)

Upvotes: 40

Views: 43191

Answers (18)

Yusuf BESTAS
Yusuf BESTAS

Reputation: 194

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

Upvotes: 2

Kesha Antonov
Kesha Antonov

Reputation: 420

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

Upvotes: 1

Rahul Mankar
Rahul Mankar

Reputation: 124

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

Upvotes: 1

Kirill Kohan
Kirill Kohan

Reputation: 197

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

Upvotes: 3

Kelvin
Kelvin

Reputation: 689

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

Upvotes: 1

Bharat Lalwani
Bharat Lalwani

Reputation: 1520

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.

Upvotes: 5

Roc Boronat
Roc Boronat

Reputation: 12141

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

Upvotes: 9

yachaka
yachaka

Reputation: 5569

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.

Upvotes: 5

Mukesh Singh
Mukesh Singh

Reputation: 51

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

Upvotes: 2

Bruno Sousa
Bruno Sousa

Reputation: 36

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

Upvotes: 0

Biswajit Pal
Biswajit Pal

Reputation: 101

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

Upvotes: 5

asukiaaa
asukiaaa

Reputation: 1674

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

enter image description here

Upvotes: 0

Karl von Randow
Karl von Randow

Reputation: 484

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.

Upvotes: 0

Ashwin
Ashwin

Reputation: 7637

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

Upvotes: 2

Dina Nashaat
Dina Nashaat

Reputation: 37

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

Upvotes: 0

Rafael Motta
Rafael Motta

Reputation: 2527

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

Upvotes: 83

agm1984
agm1984

Reputation: 17132

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

Upvotes: 19

BONEMX
BONEMX

Reputation: 31

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.

Upvotes: 3

Related Questions