gpt4 book ai didi

swift - 链接器失败,退出代码为 1。

转载 作者:搜寻专家 更新时间:2023-11-01 07:17:53 25 4
gpt4 key购买 nike

我有一个简单的 iOS swift 3 项目,在 XCode 8.1 (8B62) 中运行,可以正常编译并执行。将它推送到我的 SVN 存储库,我的同事也得到了它,并且可以正常工作。一切正常。

我们必须添加一个 pod,所以完成了。 (pod 是一个基于 Cocoa Lumber jack 的小型日志工具,在我们所有的项目中使用了很长时间)我的 2 个同事在几分钟内就让它工作了。但是,我收到链接器失败错误。链接器错误是关于 -lCocoaLumberjack,但如果我添加任何其他 pod,链接器遇到的第一个 pod 会使它崩溃。

我已经尝试了在其他类似问题上提出的所有技巧,清理项目,清除派生数据,重新启动 xcode,更改架构参数,清理 pod,取消集成 pod,清理测试主机,删除测试目标......一千次

我已经删除了项目,然后从 repo 下载回来,遇到了同样的问题。

我还更新了 cocoapods 到 v1.1.1。 (和我的同事一样)。使用_框架!或者似乎永远不会做不同的事情。

由于我的同事拥有完全相同的项目、源和 Pod,我想我可以排除项目、工作区、构建配置/设置错误。那么我在哪里可以检查可能导致问题的有关链接器、xcode 或环境变量的其他配置?

谢谢你的帮助

如果有帮助,从链接器记录:

Ld /Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Products/Debug-iphoneos/Inwebo.framework/Inwebo normal arm64
cd /Users/romain/Documents/Projects/MMXComponents/Inwebo/trunk
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -L/Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Products/Debug-iphoneos -L/Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Products/Debug-iphoneos/CocoaLumberjack -L/Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Products/Debug-iphoneos/Logger -L/Users/romain/Documents/Projects/MMXComponents/Inwebo/trunk/Inwebo/iwlib -F/Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Products/Debug-iphoneos -filelist /Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Intermediates/Inwebo.build/Debug-iphoneos/Inwebo.build/Objects-normal/arm64/Inwebo.LinkFileList -install_name @rpath/Inwebo.framework/Inwebo -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=8.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Intermediates/Inwebo.build/Debug-iphoneos/Inwebo.build/Objects-normal/arm64/Inwebo_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Intermediates/Inwebo.build/Debug-iphoneos/Inwebo.build/Objects-normal/arm64/Inwebo.swiftmodule -ObjC -lCocoaLumberjack -lLogger -lmaccess -lPods-Inwebo -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Intermediates/Inwebo.build/Debug-iphoneos/Inwebo.build/Objects-normal/arm64/Inwebo_dependency_info.dat -o /Users/romain/Library/Developer/Xcode/DerivedData/Inwebo-cjsvoynkmpchgtfqkxxactulxfci/Build/Products/Debug-iphoneos/Inwebo.framework/Inwebo

ld: library not found for -lCocoaLumberjack
clang: error: linker command failed with exit code 1 (use -v to see invocation)

播客文件:

platform :ios, '8.0'
inhibit_all_warnings!
#use_frameworks!

# ――― Pre-Install ――――――――――――――――――― #

plugin 'cocoapods-art', :sources => [
'master',
'cocoapods-psa'
]
# ――― Install ―――――――――――――――――――――― #

def shared_pods
pod 'Logger', '~> 1.0'
end

target 'Inwebo' do
shared_pods
end

最佳答案

  • 清理并构建项目,然后运行应用
  • 还是错误?在 Build Settings 部分选中 Enable Bitcode Option。

尝试反转选项并重试(如果打开,则关闭,反之亦然)

此问题有时是由于您的项目和库之间的“启用位码”选项不匹配造成的。

关于swift - 链接器失败,退出代码为 1。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40972300/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com