views:

1118

answers:

3

I have compiled tesseract for using it in xcode following: http://iphone.olipion.com/cross-compilation/tesseract-ocr

I obtain the .a file, import it as framework in the iphone project, and update the header search path for tesseract header files.

So now I need a simple example in order to get start. I can't find anything in http :// code.google.com/p/tesseract-ocr/ or by googling.

Anyone can help me give me a starting point (a code snippet)..?! Many ThankS!

-- Later i found this code:

#include "baseapi.h"


TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL); char* text = TessBaseAPI::TesseractRect(imagedata, bytes_per_pixel, bytes_per_line, 0, 0, width, height); TessBaseAPI::End();


but when I try to compile for device (only inserting include statement without the code above) i get the following:

error:syntax error before 'PAGE_RES' warning:type defaults to 'int' in declaration of 'PAGE_RES' warning:data definition has no type or storage class

and so on with BLOCK_LIST, IMAGE etc.


if compile for simulator i get

error: expected '=',',',','asm' or 'attribute' before 'PAGE_RES' and so on with BLOCK_LIST, IMAGE and TessBaseAPI

--- Other Update: I found solution for include problem: Where the include occurs must be rename the file.m in .mm extension because we have to tell xcode that we have to use objective-c and c++ together.

A: 

I'm trying to Cross compiling tesseract(2.0.4) - run on iPhone, i used the following script in (http://robertcarlsen.net/2009/07/15/cross-compiling-for-iphone-dev-884)

I'm running in Mac Os x 10.6.2,Iphone SDK 3.2/4.0.

i'm getting the following error. ERROR: /usr/bin/lipo: specifed architecture type (arm) for file (lnsout/libtesseract_full.a.arm) does not match it's cputype (16777223) and cpusubtype (3) (should be cputype (12) and cpusubtype (0))

Sam
This is not an answer, it is a question
Cirrostratus
A: 

you'll need to update SDKROOT, CPPFLAGS and CXX variables. For example, here's the relevant part of my build script, modified to work with 4.0: export SDKROOT=$DEVROOT/SDKs/iPhoneOS4.0.sdk export PATH=$DEVROOT/usr/bin:$PATH

Set up relevant environment variables

export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin10/4.0.1/ include/ -I$SDKROOT/usr/include/ -miphoneos-version-min=4.0" export CFLAGS="$CPPFLAGS -arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT" export CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" export CXXFLAGS="$CFLAGS"

Dynamic library location generated by the Unix package

LIBPATH=$LIBFILE.dylib LIBNAME=basename $LIBPATH

export LDFLAGS="-L$SDKROOT/usr/lib/ -Wl,- dylib_install_name,@executable_path/$LIBNAME"

Static library that will be generated for ARM

LIBPATH_static=$LIBFILE.a LIBNAME_static=basename $LIBPATH_static

TODO: add custom flags as necessary for package

./configure CXX=$DEVROOT/usr/bin/arm-apple-darwin10-g++-4.0.1 CC= $DEVROOT/usr/bin/arm-apple-darwin10-gcc-4.0.1 LD=$DEVROOT/usr/bin/ld --host=arm-apple-darwin

Sam