Xcode 10.0 GM - dyld:懒符号绑定失败:无法解析符号___cxa_guard_acquire崩溃.在那之前它工作得很好

Ian*_*dor 6 ios ios-simulator cocoapods swift xcode10

我用可可豆荚来安装de TesseractOCRlibrary.该应用程序在包括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) 
Run Code Online (Sandbox Code Playgroud)

Vin*_*eph 4

libstdc++ is removed in iOS 12 simulator but it remains in the iOS 12.0 (device) .
Run Code Online (Sandbox Code Playgroud)

因此,作为解决方法,您可以将库 (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
Run Code Online (Sandbox Code Playgroud)

结尾

  • 我在 podfile 的项目中添加了相同的代码,但崩溃仍然发生,请问有什么帮助吗? (2认同)