Xcode 10 (iOS 12) 不包含 libstdc++6.0.9
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50694822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 10 (iOS 12) does not contain libstdc++6.0.9
提问by CoderAzreal
回答by Jeremy Huddleston Sequoia
libstdc++ was deprecated 5 years ago. Apple's more recent platforms (tvOS and watchOS) don't support it.
libstdc++ 5 年前已弃用。Apple 较新的平台(tvOS 和 watchOS)不支持它。
Support was removed from the iOS 12.0 Simulator runtime, but it remains in the iOS 12.0 (device) runtime for binary compatibility with shipping apps.
支持已从 iOS 12.0 Simulator 运行时中移除,但它仍保留在 iOS 12.0(设备)运行时中,以实现与交付应用程序的二进制兼容性。
You should update your project to use libc++ rather than libstdc++ by setting the CLANG_CXX_LIBRARY build setting ("C++ Standard Library") to libc++.
您应该通过将 CLANG_CXX_LIBRARY 构建设置(“C++ 标准库”)设置为 libc++ 来更新您的项目以使用 libc++ 而不是 libstdc++。
If you have any static libraries that depend on libstdc++.tbd, you can workaround it for now by copying the file from the SDKs in Xcode 9.4 (and libstdc++.*.dylib in the iOS simulator runtime), but that is not a long term solution. You should contact the provider of those libraries and request versions built using libc++.
如果您有任何依赖于 libstdc++.tbd 的静态库,您现在可以通过从 Xcode 9.4 中的 SDK(以及 iOS 模拟器运行时中的 libstdc++.*.dylib)复制文件来暂时解决它,但这不是长期的解决方案。您应该联系这些库的提供者并请求使用 libc++ 构建的版本。
回答by Antigp
You may copy it from old Xcode(9.4). It should work.
您可以从旧的 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/
回答by Oscar Apeland
libstdc++
is removed in iOS 12.
libstdc++
在 iOS 12 中被删除。
I wish I had a better source than an Apple engineer on Twitter, but that's all I have.
我希望我在 Twitter 上有一个比 Apple 工程师更好的资源,但这就是我所拥有的。
@jeremyhuPSA: libstdc++ is gone from the iOS 12.0 SDK (it is present in the runtime for binary compatibility). It's days are numbered on macOS as well. Migrate over to libc++ if you haven't already. #WWDC2018 #cplusplus
@jeremyhuPSA:libstdc++ 已从 iOS 12.0 SDK 中消失(它存在于运行时中以实现二进制兼容性)。在 macOS 上的日子也屈指可数了。如果您还没有迁移到 libc++。#WWDC2018 #cplusplus
Edit: Here's a better source, Xcode 10 patch notes
编辑:这是一个更好的来源,Xcode 10 补丁说明
Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)
使用 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)
回答by u5133716
Xcode 10 cancels the libstdc++ library with built-in the lib so we should copy the file to the lib by hand.
Xcode 10 取消了内置 lib 的 libstdc++ 库,因此我们应该手动将文件复制到 lib。
copy the file: (libstdc++.6.0.9.tbd) and (libstdc++.6.tbd) to :
将文件:(libstdc++.6.0.9.tbd) 和 (libstdc++.6.tbd) 复制到:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
and
和
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
(Please note the distinction "iPhoneOS" and "iPhoneSimulator")
(请注意区分“iPhoneOS”和“iPhoneSimulator”)
clean xcode and rebuild it.
清理 xcode 并重建它。
Hereis the file.
这是文件。
回答by C?ur
Taken from Xcode 10 Beta 2 release notesand applicable to all future versions of Xcode:
摘自Xcode 10 Beta 2 发行说明,适用于所有未来版本的 Xcode:
Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)
使用 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)
Apple will unlikely ever support libstdc++ again.
Apple 不太可能再次支持 libstdc++。
回答by RamboLu
Because apple removes libstdc++ in Xcode 10.0, so if you want to solve the problem, you can try to manually copy the file to lib.
因为苹果在Xcode 10.0中去掉了libstdc++,所以如果想解决问题,可以尝试手动将文件复制到lib。
1.iPhoneOS
and iPhoneSimulator
file
1.iPhoneOS
和iPhoneSimulator
文件
copy the file: libstdc++.6.0.9.tbd
and libstdc++.6.tbd
and libstdc++.tbd
to :
复制文件:libstdc++.6.0.9.tbd
和libstdc++.6.tbd
和libstdc++.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/
/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/
2.iOS.simruntime
file
2.iOS.simruntime
档案
copy the file: libstdc++.6.0.9.dylib
and libstdc++.6.dylib
and libstdc++.dylib
to:
将文件: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
- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib
回答by Tahir Pasha
I've faced the same issue after updating to xcode 10. I've resolved this issue by downloading libstdc++.6.0.9.tbd and libstdc++.6.tbd from https://github.com/Kila2/libstdc-.6.0.9.tbd.
更新到 xcode 10 后,我遇到了同样的问题。我通过从https://github.com/Kila2/libstdc-.6.0下载 libstdc++.6.0.9.tbd 和 libstdc++.6.tbd 解决了这个问题。 9.待定。
then i copied these files to my project folder. After that I added these libs in Linked Frameworks and Libraries by following these steps: Project > Target > General > Linked Frameworks and Libraries click (+) > Click 'Add Other' > Navigat to your project folder in 'Open File' and select these libraries and add.
然后我将这些文件复制到我的项目文件夹中。之后,我按照以下步骤在链接框架和库中添加了这些库:项目>目标>常规>链接框架和库单击(+)>单击“添加其他”>导航到“打开文件”中的项目文件夹并选择这些库并添加。
Now run the project it will run perfectly..
现在运行项目,它将完美运行..
回答by Sergey Teryokhin
For me -l"stdc++.6" was added during pod install
I found it in 'Pods/Target\ Support\ Files/Pods-SomeTarget/Pods-SomeTarget.debug.xcconfig'
对我来说 -l"stdc++.6" 是在pod install
我在 'Pods/Target\ Support\ Files/Pods-SomeTarget/Pods-SomeTarget.debug.xcconfig' 中找到它时添加的
To resolve the issue you can use post_install handler in Podfile:
要解决此问题,您可以在 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
回答by Anup
Jeremy Huddleston Sequoia's answer gave me the direction to resolve this issue. So before going ahead, make sure you have read his answer.
Jeremy Huddleston Sequoia 的回答给了我解决这个问题的方向。因此,在继续之前,请确保您已阅读他的回答。
Even after updating the C++ library in your project, you might face a linking error where Xcode is not able to link your project with this libstdc++ lib.
即使在您的项目中更新 C++ 库之后,您也可能会遇到链接错误,即 Xcode 无法将您的项目与这个 libstdc++ 库链接。
The solution is - if your project structure has libstdc++ included, it might have turned red because Xcode couldn't find the reference for it. If you remove that entry from the project structure and add the new lib instead(libc++), you're good to go.
解决方案是 - 如果您的项目结构包含 libstdc++,它可能会变成红色,因为 Xcode 找不到它的参考。如果您从项目结构中删除该条目并添加新的库(libc++),那么您就可以开始了。
回答by Fan
Copy it from old Xcode(9.4) will work for physical iOS devices.
For Simulator issues with Did find: /usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator
. Looks like apple removed compatibility support for simulator. Just download iOS 11.4 simulator and it can be run on it.
从旧的 Xcode(9.4) 复制它适用于物理 iOS 设备。对于模拟器问题Did find: /usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator
。看起来苹果删除了对模拟器的兼容性支持。只需下载iOS 11.4模拟器即可在其上运行。