iosxcodegcctesseract

Xcode 5 llvm-g++ and llvm-gcc path?


I'm building an app for iOS7 with Xcode 5 using Google Tesseract OCR: http://lois.di-qual.net/blog/install-and-use-tesseract-on-ios-with-tesseract-ios/

It worked fine with English recognition but I couldn't add any other language to the project. Then I found some other projects do it successfully by compiling Tesseract library: http://inspirationteam.weebly.com/home/compile-use-tesseract-ocr-lib-301-on-ios http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/

According to these articles, my llvm-g++ and llvm-gcc should be in

export CXX="$DEVROOT/usr/bin/llvm-g++"
export CC="$DEVROOT/usr/bin/llvm-gcc"

With $DEVROOT should be something like

export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer

While I'm using Xcode 5 and Mac OSX 9.2 (I've heard that there're somethings had changed about C compiler with these guys), these paths didn't work for me:

checking build system type... i386-apple-darwin13.3.0
checking host system type... i386-apple-darwin13.3.0
checking how to print strings... printf
checking for gcc... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc
checking whether the C compiler works... no
configure: error: in `/Users/phuoc-de/Desktop/a/leptonica-1.71':
configure: error: C compiler cannot create executables
See `config.log' for more details

I've already installed Command line, but it still didn't work. Does anyone know how to solve this problem? Thanks.


Solution

  • I found my answer here

    export CXX=`xcrun -find c++`
    export CC=`xcrun -find cc`
    

    Hope it helps someone!