[英]ld: library not found for -lDoubleConversion React Native 0.59
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这是我所做的
First of all, make sure that Libraries -> React.xcodeproj -> ThirdParty -> double-conversion
exists and a static library is being produced from it, like this:首先,确保
Libraries -> React.xcodeproj -> ThirdParty -> double-conversion
存在并且正在从中生成一个静态库,如下所示:
Then, if are you're using cocoapods, make sure to add DoubleConversion
to your Podfile
:然后,如果您使用的是 cocoapods,请确保将
DoubleConversion
添加到您的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.最后,如果到目前为止这些都不起作用,您可以手动运行一个脚本来解决 React 的第三方依赖项。
Just go to node_modules/react-native
and type:只需转到
node_modules/react-native
并输入:
$ ./scripts/ios-install-third-party.sh
Important : Always run it inside node_modules/react-native
.重要提示:始终在
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
.因为,据我所知,脚本使用相对路径来存储第三方的源代码,而 react native 将始终在
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.注意:此脚本可能已经作为项目的构建阶段运行。
I followed the answers on Why linker link static libraries with errors?我遵循了为什么链接器链接静态库有错误的答案? iOS but nothing worked for me since I was combining the answers.
iOS,但自从我结合答案以来,对我没有任何作用。
I got it to work by ONLY doing the "create new Swift-file"-trick.我只通过执行“创建新的 Swift 文件”技巧就让它工作了。 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).
所以删除所有东西,重新安装,只添加一个新的 Swift 文件来创建桥接头(不要删除 Swift 文件)。
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 (在继续之前,请确保
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
包含在您的 podfile 中
1. Delete Podfile.lock
2. cd ios
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.通过打开 ios 目录中的 xcworkspace 文件运行 react-native-run-ios 或 Build with Xcode。
This is what finally worked for me.这就是最终对我有用的方法。
pod deintegrate吊舱解体
pod install吊舱安装
Open project in X-Code在 X-Code 中打开项目
Remove Resources folder from left sidebar从左侧边栏中删除资源文件夹
Build your project from New Build System.从 New Build System 构建您的项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.