8

I used cocoa pods to install de TesseractOCR library. The app works fine when running on devices, including iOS12 devices. The crash only occurs on the iOS12 Simulator. I also installed the iOS 11.4 Simulator and it works fine on that one. I've been scratching my head for this for a while. This is the crash I get.

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) 
Jogendar Choudhary
  • 3,476
  • 1
  • 12
  • 26
Iancu Tudor
  • 113
  • 1
  • 8

3 Answers3

4
libstdc++ is removed in iOS 12 simulator but it remains in the iOS 12.0 (device) .

So as a workaround you can copy the library (libstdc++.6.0.9.tbd) from Xcode 9.4 to Xcode 10. But this is not a long term solution. You should contact the provider of those libraries and request versions built using libc++.

OR You can add following command to your pod file if you're using Cocoapods as a dependency manager:

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

end

Vineeth Joseph
  • 5,177
  • 3
  • 17
  • 31
  • 1
    How does the scripting help with the linking problem? I can see that it solves another problem with duplicate .h file, but not how it relates to the question asked here. – Dale Dec 28 '18 at 01:32
  • 2
    I added the same code in my project in podfile, but the crash is still happening, any help please ? – omartarek32 Jun 12 '19 at 19:31
2

As a cleaner approach you can now replace in your pod file the framework as:

pod 'TesseractOCRiOS', :git => 'git://github.com/parallaxe/Tesseract-OCR-iOS.git', :branch => 'macos-support'

Support has been added in this branch for iOS 12. Hope this helps someone as it did me :)

Samir K
  • 91
  • 2
  • 11
  • This works on the simulator but crashes on the device with a `read_params_file: parameter not found: enable_new_segsearch` error – MateusK May 30 '19 at 14:42
1

I had to copy the dylib files, not the tdb files to get the simulator running.

Prerequisites: You have Xcode 9.4 installed with exactly that name. Change FROM and even TO below if necessary.

This is my terminal commands for copying the dylib files:

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

WARNING! You should be really careful since there is a sudo involved. DO YOU TRUST ME?

The script will do a dry run if you copy my command right off. Remove the : in front of sudo to actually modify your filesystem. set -x will enable logging of all commands executed.

Not related to the question, but if you use CocoaPods you will probably need to apply the following patch at some point as well: https://gist.github.com/gali8/7d090865a904a16caf5a7a3116c3c3ab

JKvr
  • 650
  • 7
  • 15