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

Undefined symbols for architecture armv7 #213

Closed Jan-M-B closed 9 years ago

Jan-M-B commented 9 years ago

Hi, I created the framework file to use Tesseract for iOS, but I get the following errors:

Undefined symbols for architecture armv7: "_OBJCCLASS$_G8RecognitionOperation", referenced from: objc-class-ref in ViewController.o "_OBJCCLASS$_G8Tesseract", referenced from: objc-class-ref in ViewController.o

and also the warning that files missing the armv7 architecture, any help?

Jan

kevincon commented 9 years ago

Can you provide more details about how you created the framework?

Alternatively, if you just want to get up and running with Tesseract without worrying about creating the framework file yourself, you should just use CocoaPods to install the Tesseract library for a project: https://github.com/gali8/Tesseract-OCR-iOS/wiki/Installation#integrate-the-framework-into-an-existing-project-using-cocoapods

Jan-M-B commented 9 years ago

I create it like you mentioned here: https://github.com/gali8/Tesseract-OCR-iOS/issues/128#issuecomment-69146700 and add it to my project like it's explained here: http://cocoadocs.org/docsets/TesseractOCRiOS/3.4.0/

kevincon commented 9 years ago

Both of those instructions are outdated. Officially we no longer support projects that integrate the framework manually because CocoaPods is so much easier to use.

That being said, it sounds like you might be using an outdated version of the library files to try to build the framework. How did you get the library source files to build the framework?

Jan-M-B commented 9 years ago

I'm not sure if I understand you right: I just use the Tesseract-OCR-iOS.xcworkspace project and the xctool command.

kevincon commented 9 years ago

Yes but where did you get that project? Did you download it from one of the zip files on the GitHub Releases page (https://github.com/gali8/Tesseract-OCR-iOS/releases)? If so, which version did you download? Or did you clone it using git clone git@github.com:gali8/Tesseract-OCR-iOS.git?

Jan-M-B commented 9 years ago

I used the "Download ZIP" button at the main page.

kevincon commented 9 years ago

I see, using that button would download the contents of the master branch of this repo.

The problem is that using the xctool on the command line doesn't build for all of the architectures (for example, armv7). You can specify a specific architecture you want it to build for via the -arch flag (e.g. -arch armv7), but I don't know how to specify that it should build for multiple architectures.

Can you explain why you don't want to use CocoaPods to install the library for your project?

ws233 commented 9 years ago

@Jan-M-B, at least the instructions from #120 seem to be working. So what you need is to change manually an architecture for any target you use. For example, if you try to run your app under device you should use the following command:

xctool -workspace Tesseract-OCR-iOS.xcworkspace -scheme TesseractOCR -configuration Release -sdk iphoneos CONFIGURATION_BUILD_DIR=./Products

If you try to run it under simulator you should specify -sdk iphonesimulator instead of iphoneos as I remember. If you you wish to create an archive, you should combine both of that executables above in one fat binary with the lipo tool, as I again remember.

But do you need those dances, if pod makes all of those automatically for you? Just install Cocoapods and create a simple Podfile as it's mentioned in the installation page.

Jan-M-B commented 9 years ago

Thanks @kevincon and @ws233 it works now :)

But do you need those dances, if pod makes all of those automatically for you?

It's just the handling I like more ....