libstdc ++在5年前就已经被弃用了。 苹果的更近期的平台(tvOS和watchOS)不支持它。
iOS 12.0模拟器运行时已删除对其的支持,但为了与发布的应用程序二进制兼容性保持一致,iOS 12.0(设备)运行时仍然支持它。
您应该通过将CLANG_CXX_LIBRARY构建设置(“C ++标准库”)设置为libc++来更新项目,而不是使用libstdc ++。
如果您有任何依赖于libstdc++.tbd的静态库,您可以通过从Xcode 9.4中的SDK中复制文件(以及iOS模拟器运行时中的libstdc++. * .dylib)来解决它,但这并不是长期的解决方案。 您应该联系这些库的提供者,并请求使用libc ++构建的版本。
您可以从旧版Xcode(9.4)中复制它。它应该能够正常工作。
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
libstdc++
在iOS 12中已被移除。
我希望我有比Twitter上的苹果工程师更好的消息来源,但这就是我所拥有的。
@jeremyhu PSA:libstdc++在iOS 12.0 SDK中已经不再使用(它在二进制兼容性方面在运行时仍然存在)。 它的日子也在macOS上受到限制。 如果您还没有迁移到libc ++,请立即进行迁移。 #WWDC2018 #cplusplus
编辑:这里有一个更好的消息来源,Xcode 10补丁说明
使用libstdc ++构建已于Xcode 8被弃用,并且在面向iOS的Xcode 10中不受支持。 C ++项目现在必须迁移到libc ++,并推荐设置部署目标为iOS 7或更高版本。除了更改C ++标准库构建设置之外,开发人员还应审核硬编码的链接器标志和目标依赖项以删除对libstdc ++的引用(包括-lstdc ++,-lstdc ++ .6.0.9,libstdc ++。6.0.9.tbd和libstdc ++。6.0.9.dylib)。还需要针对使用libstdc ++构建的项目依赖项(如静态归档)重新构建libc ++。 (40885260)
Xcode 10取消了内置的libstdc++库,因此我们需要手动将文件复制到lib中。
将文件(libstdc++.6.0.9.tbd)和(libstdc++.6.tbd)复制到:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
和
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
请注意“iPhoneOS”和“iPhoneSimulator”的区别。dylib
文件。它们应该位于Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
。 - khcpietro自 Xcode 8 开始,使用 libstdc++ 构建已被弃用,并且在面向 iOS 的 Xcode 10 中不再受支持。C++ 项目现在必须迁移到 libc++,并建议设置 iOS 7 或更高版本的部署目标。除了更改 C++ 标准库构建设置外,开发人员还应审核硬编码链接器标志和目标依赖项,以删除对 libstdc++(包括 -lstdc++、-lstdc++.6.0.9、libstdc++.6.0.9.tbd 和 libstdc++.6.0.9.dylib)的引用。针对 libstdc++ 构建的静态存档等项目依赖项也需要重新构建为 libc++。 (40885260)
苹果公司不太可能再次支持 libstdc++。
更新到Xcode 10后,我遇到了同样的问题。通过从https://github.com/Kila2/libstdc-.6.0.9.tbd下载libstdc++.6.0.9.tbd和libstdc++.6.tbd文件来解决这个问题。
然后,我将这些文件复制到我的项目文件夹中。之后按照以下步骤添加这些库到“链接的框架和库”中:
Project > Target > General > Linked Frameworks and Libraries 点击(+) > 点击'Add Other' > 在'Open File'中导航到你的项目文件夹并选择这些库并添加。
现在运行该项目,它将完美运行。
iPhoneOS
和iPhoneSimulator
文件libstdc++.6.0.9.tbd
和 libstdc++.6.tbd
和 libstdc++.tbd
复制到:iOS.simruntime
文件libstdc++.6.0.9.dylib
和 libstdc++.6.dylib
和 libstdc++.dylib
复制到:/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator
,可以尝试将原始文件:libstdc++.6.0.9.dylib
、libstdc++.6.dylib
和libstdc++.dylib
复制到以下目录中:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib
。 - RamboLu在我的 pod install
过程中,-l"stdc++.6" 被添加了。
我在 'Pods/Target\ Support\ Files/Pods-SomeTarget/Pods-SomeTarget.debug.xcconfig' 中找到了它。
要解决这个问题,你可以在 Podfile 中使用 post_install 处理程序:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "Pods-SomeTarget”
puts "Updating #{target.name} OTHER_LDFLAGS"
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.gsub('-l"stdc++.6" ', '')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
end
Jeremy Huddleston Sequoia的答案给了我解决这个问题的方向。所以在继续之前,请确保你已经阅读了他的答案。
即使在更新项目中的C++库之后,您可能仍会面临链接错误,其中Xcode无法将您的项目与此libstdc++库链接起来。
解决方法是 - 如果您的项目结构包含了libstdc++,它可能变成了红色,因为Xcode找不到它的引用。如果您从项目结构中删除该条目并添加新的lib(libc++)代替,您就可以继续了。
libc++
而不是libstdc++
。 - Anbu.Karthiklibc++
,而且libstdc++
也不可用。 - sgdesmet