Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-10-2010, 12:24 AM   #17 (permalink)
sam1122
Registered Member
 
Join Date: Sep 2010
Posts: 1
sam1122 is on a distinguished road
Exclamation Cross compiling tesseract - run on iPhone

HI,
I'm using the following script to build the tesseract in my mac OS X 10.6.2. I'm getting the following error, please help me to resolve this.

Regards,
Shane.

=========Script============
#!/bin/sh

# build_fat.sh
#
# Created by Robert Carlsen on 15.07.2009.
# Updated 6.12.2009 to build i386 (simulator) on an x86_64 platform (10.6 SDK)
# build an arm / i386 lib of standard linux project
#
# adopted from:
# Latenitesoft: Mac & iOS Applications: iPhone Programming Tips: building Unix software
#
# initially configured for tesseract-ocr

# Set up the target lib file / path
# easiest to just build the package normally first and watch where the files are created.
LIBFILE=ccmain/libtesseract_full

# Select the desired iPhone SDK
export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
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

make -j4

# Copy the ARM library to a temporary location
mkdir -p lnsout
cp $LIBPATH_static lnsout/$LIBNAME_static.arm

# Do it all again for native cpu
make distclean

# Restore default environment variables
unset CPPFLAGS CFLAGS CPP LDFLAGS CXXFLAGS DEVROOT SDKROOT

export DEVROOT=/Developer
export SDKROOT=$DEVROOT/SDKs/MacOSX10.6.sdk

export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/ -I$SDKROOT/usr/include/ -mmacosx-version-min=10.5"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT -arch i386"
export CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS"
export CXXFLAGS="$CFLAGS"

#Overwrite LDFLAGS
# Dynamic linking, relative to executable_path
# Use otool -D to check the install name
export LDFLAGS="-Wl,-dylib_install_name,@executable_path/$LIBNAME"

# TODO: error checking
./configure
make -j4

# Copy the native library to the temporary location
cp $LIBPATH_static lnsout/$LIBNAME_static.i386

# Create fat lib by combining the two versions
/usr/bin/lipo -arch arm lnsout/$LIBNAME_static.arm -arch i386 lnsout/$LIBNAME_static.i386 -create -output lnsout/$LIBNAME_static

unset CPPFLAGS CFLAGS CPP LDFLAGS CPP CXXFLAGS DEVROOT SDKROOT
==========================

===Error i'm Getting============
/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))
=======


Cheers,
sam1122 is offline   Reply With Quote
 

» Advertisements
» Online Users: 419
14 members and 405 guests
alexdesuja, chemistry, Chickenrig, EvilElf, iconomania, ipodphone, larhondaxzcw, linkmx, Manish915, Mnadeep, nanijoe, PlutoPrime, SamorodovAlex, zhaoningmei
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,585
Threads: 94,082
Posts: 402,773
Top Poster: BrianSlick (7,990)
Welcome to our newest member, alexdesuja
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:22 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.