ios - 架构 x86_64 的 1159 个重复符号
<p><p>我最近在使用 <code>react-native-maps</code> 时遇到了一个奇怪的问题。尝试通过 xcode 编译应用程序时,出现以下错误</p>
<pre><code>...
ld: 1159 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre>
<p> <a href="https://pastebin.com/kJABwBwN" rel="noreferrer noopener nofollow">Whole stacktrace</a> </p>
<p>到目前为止,我已经尝试了所有方法。例如这些帖子 <a href="https://stackoverflow.com/questions/24298144/duplicate-symbols-for-architecture-x86-64-under-xcode" rel="noreferrer noopener nofollow">first</a> <a href="https://stackoverflow.com/questions/26303782/duplicate-symbols-for-architecture-arm64/26303957" rel="noreferrer noopener nofollow">second</a> </p>
<p>这是我的 Podfile:</p>
<pre><code>platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target "__APP_NAME__" do
react_native_path = "../node_modules/react-native"
pod "yoga", :path => "#{react_native_path}/ReactCommon/yoga"
pod 'React', path: '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'GoogleMaps'
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end
</code></pre>
<p>我还尝试使用在 react-native-maps 存储库的自述文件中指定的完全相同的 Podfile(结果相同),并尝试删除 <code>-ObjC</code> 标志来自 <code>Other Linker Flags</code> 并导致应用程序构建,但是当我尝试启动它时,它在 main.m 文件中因 <code>Thread 1: signal SIGABRT</code> 而崩溃。
<a href="/image/wxAKs.png" rel="noreferrer noopener nofollow"><img src="/image/wxAKs.png" alt="Thread 1: signal SIGABRT"/></a> </p>
<h1>编辑:</h1>
<p>在安装 <code>react-native-maps</code> 之前我已将我的 git repo 恢复为重新安装了所有节点模块并尝试重新安装所有 pod(我运行了 <a href="https://gist.github.com/mbinna/" rel="noreferrer noopener nofollow">this</a> 和 <code>rm - rf ~/.cocoapods/repos/master && pod setup && pod install</code>) 然后尝试在 xcode 中重建项目,但仍然出现相同的错误。我的播客文件</p>
<pre><code>platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target "_APP_" do
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
end
</code></pre>
<p>我现在想知道,我的项目出了什么问题?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>所以,经过大约一整天的调试,我找到了应用程序无法构建的原因。如果我在发布此答案之前没有解决它@Christos Koninis 评论会让我找到问题的根本原因。我再次查看日志,发现我一直在使用 <code>React</code> 的两个实例。一个来自 <code>node_modules/</code>,一个来自 <code>ios/pods/</code>。我缺少的是我的 Podfile 中的这个:</p>
<pre><code>post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
</code></pre>
<p> <a href="https://github.com/react-native-community/react-native-svg/issues/621#issuecomment-371639854" rel="noreferrer noopener nofollow">Credits</a> </p>
<p>最后我的 Podfile 看起来像这样:</p>
<pre><code>platform :ios, '9.0'
target "_APP_" do
rn_path = '../node_modules/react-native' # This path is likely to be `../node_modules/react-native` in your own project.
rn_maps_path = '../node_modules/react-native-maps' # This path is likely to be `../node_modules/react-native-maps` in your own project.
# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
# React Native third party dependencies podspecs
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path# Remove this line if you don't want to support GoogleMaps on iOS
pod 'GoogleMaps'# Remove this line if you don't want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS
# Firebase
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end
</code></pre></p>
<p style="font-size: 20px;">关于ios - 架构 x86_64 的 1159 个重复符号,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/52168666/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/52168666/
</a>
</p>
页:
[1]