Xcode 在编译器开始编译时显示错误

Posted

技术标签:

【中文标题】Xcode 在编译器开始编译时显示错误【英文标题】:Xcode displayed error while compiler start to compile 【发布时间】:2017-09-22 03:57:06 【问题描述】:

我构建了一个项目。依赖项是通过 CocoaPods 管理的。 项目运行时。出现如下错误:

Ld /Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/iXueXi.app/iXueXi 普通 x86_64 cd /Users/zhaoxinqiang/Desktop/iXueXi 导出 IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/ACAlertController -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/AFNetworking -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/AliyunOSSios -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/BACustomAlertView -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/MBProgressHUD -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/MJRefresh -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/Mantle -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/Masonry -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/Reachability -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/ReactiveObjC -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/SDAutoLayout -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/SDCycleScrollView -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/SDWebImage -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/TYPagerController -L/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/TZImagePickerController -L/Users/zhaoxinqiang/Desktop/iXueXi/Pods/JCore -L/Users/zhaoxinqiang/Desktop/iXueXi/iXueXi/Venders/AliPay -F/Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build /产品/调试-iphone模拟器 -F/Users/zhaoxinqiang/Desktop/iXueXi/Pods/AlipaySDK-2.0 -filelist /Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Intermediates/iXueXi.build/Debug-iphonesimulator/iXueXi.build /Objects-normal/x86_64/iXueXi.LinkFileList -mios-simulator-version-min=8.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Intermediates/iXueXi.build/Debug-iphonesimulator/iXueXi.build /Objects-normal/x86_64/iXueXi_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lACAlertController -lAFNetworking -lAliyunOSSiOS -lBACustomAlertView -lMBProgressHUD -lMJRefresh -lMantle -lMasonry -lReachability -lReactiveObjC -lSDAutoLayout - lSDCycleScrollView -lSDWebImage -lTYPagerController -lTZImagePickerController -lc++ -ljcore-ios-1.1.1 -lresolv -lz -framework AlipaySDK -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreMotion -framework CoreTelephony -framework Foundation -framework ImageIO -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -weak_framework UserNotifications -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Intermediates/iXueXi.build/Debug-iphonesimulator/iXueXi.build/iXueiX。应用程序.xcent -weak_framework NotificationCenter -framework SystemConfiguration -lresolv -lssl -lcrypto -framework MediaPlayer -framework AdSupport -lPods-iXueXi -Xlinker -dependency_info -Xlinker /Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Intermediates/iXueXi .build/Debug-iphonesimulator/iXueXi.build/Objects-normal/x86_64/iXueXi_dependency_info.dat -o /Users/zhaoxinqiang/Library/Developer/Xcode/DerivedData/iXueXi-ddaxyfhwxiktmtgsfbafazqmdwlu/Build/Products/Debug-iphonesimulator/iXueXi.app/iXueXi

ld:找不到 -lssl clang 的库:错误:链接器命令失败 退出代码为 1(使用 -v 查看调用)

【问题讨论】:

1) 确保您打开的是 xcworkspace 而不是 xcodeproj。 2)清理派生数据并再次运行 你应该学习如何在***上提问,这不是一个好问题。 无法解决问题 我通过 coco pods 管理依赖,svn 到源代码控制,但我克隆项目,然后安装 pod,然后打开工作区,构建,运行,它显示错误,找不到 -lssl 的库跨度> 【参考方案1】:

有时在重命名目标或移动某些东西后,您可能会损坏您的 pod 安装。幸运的是,有一种比 sudo make install 的解决方案更简单的方法来修复它。

    运行 pod deintegrate 从您的 项目。 再次运行 pod install 以将其全部添加回来

【讨论】:

【参考方案2】:

在我的情况下,可能的解决方案之一是转到 xcode Preferences -> Locations -> Derived Data 然后清理此文件夹并再次运行。它对我有用。

【讨论】:

我知道,做了多次但无法解决..所以在这里问 解决不了..期待回复.. 在我的情况下,这是我的解决方案【参考方案3】:

我曾经遇到过同样的问题,并通过从 Target 中删除重复项目来解决它。在您的项目中查找任何重复的文件夹或文件,并从 Project 中删除所有重复项。这将解决您的问题。

【讨论】:

以上是关于Xcode 在编译器开始编译时显示错误的主要内容,如果未能解决你的问题,请参考以下文章

为啥 MyEclipse 在编译时显示 join_table not found 错误

VSCode 在编译时显示 .vue 导入的“找不到模块”TS 错误

尝试jetpack compose时显示错误:编译器后端并且无法由旧编译器加载

编译 xcode 项目时 Alamofire 的大量问题

我在代码块中编写的Stack实现代码是成功编译但在运行时显示错误

如何在编译时显示 #define 的值?