Xcode 10.0 GM - dyld:惰性符号绑定失败:无法解析符号 ___cxa_guard_acquire 崩溃。在那之前它工作正常
Xcode 10.0 GM - dyld: lazy symbol binding failed: can't resolve symbol ___cxa_guard_acquire crash. It was working fine before that
我使用 cocoa pods 安装了 de TesseractOCR
库。该应用程序在 运行 设备(包括 iOS12
设备)上运行良好。崩溃仅发生在 iOS12 模拟器上。我还安装了 iOS 11.4 Simulator
并且它在那个上运行良好。一段时间以来,我一直在挠头。这是我遇到的崩溃。
dyld: lazy symbol binding failed: can't resolve symbol ___cxa_guard_acquire in /Users/IancuTudor/Library/Developer/CoreSimulator/Devices/ABE5EE31-47C8-4457-8F33-B4C265599147/data/Containers/Bundle/Application/40814EAD-8965-47F2-8036-3DE48A8143BF/Bookly.app/Frameworks/TesseractOCR.framework/TesseractOCR because dependent dylib #1 could not be loaded
dyld: can't resolve symbol ___cxa_guard_acquire in /Users/IancuTudor/Library/Developer/CoreSimulator/Devices/ABE5EE31-47C8-4457-8F33-B4C265599147/data/Containers/Bundle/Application/40814EAD-8965-47F2-8036-3DE48A8143BF/Bookly.app/Frameworks/TesseractOCR.framework/TesseractOCR because dependent dylib #1 could not be loaded
(lldb)
libstdc++ is removed in iOS 12 simulator but it remains in the iOS 12.0 (device) .
因此,作为解决方法,您可以将库 (libstdc++.6.0.9.tbd) 从 Xcode 9.4 复制到 Xcode 10。但这不是长期解决方案。您应该联系这些库的提供者并请求使用 libc++ 构建的版本。
或者如果您使用 Cocoapods 作为依赖管理器,您可以将以下命令添加到您的 pod 文件中:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'TesseractOCRiOS'
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
header_phase = target.build_phases().select do |phase|
phase.is_a? Xcodeproj::Project::PBXHeadersBuildPhase
end.first
duplicated_header_files = header_phase.files.select do |file|
file.display_name == 'config_auto.h'
end
duplicated_header_files.each do |file|
header_phase.remove_build_file file
end
end
end
结束
我必须复制 dylib 文件,而不是 tdb 文件才能获得模拟器 运行ning。
先决条件:您安装的 Xcode 9.4 正是这个名称。如有必要,请更改下面的 FROM
甚至 TO
。
这是我用于复制 dylib 文件的终端命令:
FROM="Xcode 9.4"
TO="Xcode"
set -x; for f in /Applications/"$FROM".app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libstdc++*; do : sudo cp -p "$f" "${f/$FROM/$TO}"; done; set +x
警告!你应该非常小心,因为涉及 sudo
。你相信我吗?
如果您立即复制我的命令,该脚本将干运行。删除 sudo
前面的 :
以实际修改您的文件系统。 set -x
将启用所有已执行命令的日志记录。
与问题无关,但如果您使用 CocoaPods,您可能还需要在某些时候应用以下补丁:https://gist.github.com/gali8/7d090865a904a16caf5a7a3116c3c3ab
作为一种更简洁的方法,您现在可以将 pod 文件中的框架替换为:
pod 'TesseractOCRiOS', :git => 'git://github.com/parallaxe/Tesseract-OCR-iOS.git', :branch => 'macos-support'
已在此分支中添加了对 iOS 12 的支持。希望这对某些人和我一样有帮助:)
我使用 cocoa pods 安装了 de TesseractOCR
库。该应用程序在 运行 设备(包括 iOS12
设备)上运行良好。崩溃仅发生在 iOS12 模拟器上。我还安装了 iOS 11.4 Simulator
并且它在那个上运行良好。一段时间以来,我一直在挠头。这是我遇到的崩溃。
dyld: lazy symbol binding failed: can't resolve symbol ___cxa_guard_acquire in /Users/IancuTudor/Library/Developer/CoreSimulator/Devices/ABE5EE31-47C8-4457-8F33-B4C265599147/data/Containers/Bundle/Application/40814EAD-8965-47F2-8036-3DE48A8143BF/Bookly.app/Frameworks/TesseractOCR.framework/TesseractOCR because dependent dylib #1 could not be loaded
dyld: can't resolve symbol ___cxa_guard_acquire in /Users/IancuTudor/Library/Developer/CoreSimulator/Devices/ABE5EE31-47C8-4457-8F33-B4C265599147/data/Containers/Bundle/Application/40814EAD-8965-47F2-8036-3DE48A8143BF/Bookly.app/Frameworks/TesseractOCR.framework/TesseractOCR because dependent dylib #1 could not be loaded
(lldb)
libstdc++ is removed in iOS 12 simulator but it remains in the iOS 12.0 (device) .
因此,作为解决方法,您可以将库 (libstdc++.6.0.9.tbd) 从 Xcode 9.4 复制到 Xcode 10。但这不是长期解决方案。您应该联系这些库的提供者并请求使用 libc++ 构建的版本。
或者如果您使用 Cocoapods 作为依赖管理器,您可以将以下命令添加到您的 pod 文件中:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'TesseractOCRiOS'
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
header_phase = target.build_phases().select do |phase|
phase.is_a? Xcodeproj::Project::PBXHeadersBuildPhase
end.first
duplicated_header_files = header_phase.files.select do |file|
file.display_name == 'config_auto.h'
end
duplicated_header_files.each do |file|
header_phase.remove_build_file file
end
end
end
结束
我必须复制 dylib 文件,而不是 tdb 文件才能获得模拟器 运行ning。
先决条件:您安装的 Xcode 9.4 正是这个名称。如有必要,请更改下面的 FROM
甚至 TO
。
这是我用于复制 dylib 文件的终端命令:
FROM="Xcode 9.4"
TO="Xcode"
set -x; for f in /Applications/"$FROM".app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libstdc++*; do : sudo cp -p "$f" "${f/$FROM/$TO}"; done; set +x
警告!你应该非常小心,因为涉及 sudo
。你相信我吗?
如果您立即复制我的命令,该脚本将干运行。删除 sudo
前面的 :
以实际修改您的文件系统。 set -x
将启用所有已执行命令的日志记录。
与问题无关,但如果您使用 CocoaPods,您可能还需要在某些时候应用以下补丁:https://gist.github.com/gali8/7d090865a904a16caf5a7a3116c3c3ab
作为一种更简洁的方法,您现在可以将 pod 文件中的框架替换为:
pod 'TesseractOCRiOS', :git => 'git://github.com/parallaxe/Tesseract-OCR-iOS.git', :branch => 'macos-support'
已在此分支中添加了对 iOS 12 的支持。希望这对某些人和我一样有帮助:)