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)
For me, I solved just opening the MyAppName.xcworkspace
instead of MyAppName.xcodeproj
, and then, building.
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 !!!!!!!!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With