gali8 / Tesseract-OCR-iOS

Tesseract OCR iOS is a Framework for iOS7+, compiled also for armv7s and arm64.
http://www.nexor.it
MIT License
4.22k stars 949 forks source link

Xcode 10 Beta #375

Closed Semty closed 6 years ago

Semty commented 6 years ago

I have such problem during building my project in Xcode 10 Beta:

Multiple commands produce '/Users/User/Library/Developer/Xcode/DerivedData/
MyProject-cbinmqkyvtwpqmgivvfrgqvgiigv/Build/Products/Debug-iphonesimulator/
TesseractOCRiOS/TesseractOCR.framework/PrivateHeaders/config_auto.h':

1) Target 'TesseractOCRiOS' has copy command from 
'/Users/User/Desktop/Projects/MyProject/Pods/TesseractOCRiOS/TesseractOCR/
include/leptonica/config_auto.h' to 
'/Users/User/Library/Developer/Xcode/DerivedData/MyProject-cbinmqkyvtwpqmgivvfrgqvgiigv/
Build/Products/Debug-iphonesimulator/TesseractOCRiOS/
TesseractOCR.framework/PrivateHeaders/config_auto.h'

2) Target 'TesseractOCRiOS' has copy command from
'/Users/User/Desktop/Projects/MyProject/Pods/TesseractOCRiOS/TesseractOCR/
include/tesseract/config_auto.h' to
'/Users/User/Library/Developer/Xcode/DerivedData/MyProject-cbinmqkyvtwpqmgivvfrgqvgiigv/
Build/Products/Debug-iphonesimulator/TesseractOCRiOS/
TesseractOCR.framework/PrivateHeaders/config_auto.h'
maniramezan commented 6 years ago

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

Just noticed that this script also has the code to disable ENABLE_BITCODE. Just remove that part if that wasn't what you needed.

lyqun commented 6 years ago

@maniramezan It works. Thank you.

adytzs commented 6 years ago

Hai @maniramezan , I use this library on podspecs... Got similar error when I run

pod repo push *****

Did you have any clue to put your code on podspecs file?

maniramezan commented 6 years ago

@adytzs Not sure how that'd be. If you can share your podspecs here or share the sample code, I might be able to help

adytzs commented 6 years ago

`Pod::Spec.new do |s| s.name = "MyLib" s.version = "0.1.219" s.summary = "Utilities Library" s.homepage = "****" s.license = { :type => 'Copyright (C) 2016 by ', :text => <<-LICENSE Internal Library, Only Product allowed to use this library LICENSE } s.author = { "Yogi" => "" } s.source = { :git => "*.git", :tag => s.version } s.social_media_url = **'

s.platform = :ios, '7.1' s.requires_arc = true s.ios.deployment_target = '7.1'

s.source_files = 'MyLib/Library//*.{h,m}' s.resources = ["MyLib/Library/*/.{xib,bundle}","MyLib/Library//*.xcassets","MyLib/Library//*.otf","MyLib/Library/*/.xcdatamodeld", "MyLib/Library//Currency"]

s.dependency "AFNetworking", "~> 3.1.0" s.dependency "SDWebImage", "~> 3.8.2" s.dependency "AWSS3" s.dependency "AWSCognito" s.dependency "TesseractOCRiOS", "~> 4.0.0" s.dependency "FBSDKCoreKit", "~> 4.19.0" s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => "$(SRCROOT)/Pods/**" }

s.frameworks = 'UIKit', 'CoreText', 'Foundation' s.module_name = 'MyLib' end`

I just add TesseractOCRiOS on pod specs, If I remove it, it is working. Fyi: If i use xcode 9.xxx, it is working, after upgrading to xcode 10.xxx, it is not working anymore...

Thank you

evermeer commented 6 years ago

Issue was discussed here: https://github.com/tesseract-ocr/tesseract/issues/1524 I don't have this issue when I use https://github.com/msgrizz/TesseractOCRSDKiOS So it could be solved by changing project setting (not sure what setting) Since I'm using TesseractOCRiOS in a library (https://github.com/evermeer/PassportScanner) I don't want to use the podfile change solution. It should just work. So for now I have switched to TesseractOCRSDKiOS

heonhoch commented 2 years ago

I got the same issue did Any one found the solution of it?!