brew install automake autoconf autoconf-archive libtool pkgconfig icu4c leptonica gcc cairo pango icu4c autoconf libffi libarchive wget
export PKG_CONFIG_PATH=\
$(brew --prefix)/lib/pkgconfig:\
$(brew --prefix)/opt/libarchive/lib/pkgconfig:\
$(brew --prefix)/opt/icu4c/lib/pkgconfig:\
$(brew --prefix)/opt/libffi/lib/pkgconfig
Open Terminal app and run the following commands:
mkdir -p dependencies/include
mkdir -p dependencies/lib
cp -R ./include/curl/ dependencies/include/curl/
cp -rvf include/libcurl.a dependencies/lib/libcurl.a
download tesseract at https://github.com/tesseract-ocr/tesseract then rename like tesseract_4.1.1 at root folder
download leptonica at http://leptonica.org/download.html then rename like leptonica_1.79.0 at root folder
IOS_DEPLOY_TGT = "8.0"
PNG_VERSION = 1.6.37
TIFF_VERSION = 4.1.0
LEPT_VERSION = 1.79.0
JPEG_VERSION = 9c
TESSERACT_VERSION = 4.1.1
AX_CHECK_COMPILE_FLAG([-mavx], [avx=true], [avx=false], [$WERROR])
=> AX_CHECK_COMPILE_FLAG([-mavx], [avx=false], [avx=false], [$WERROR])
AX_CHECK_COMPILE_FLAG([-mfma], [fma=true], [fma=false], [$WERROR])
=>AX_CHECK_COMPILE_FLAG([-mfma], [fma=false], [fma=false], [$WERROR])
AX_CHECK_COMPILE_FLAG([-msse4.1], [sse41=true], [sse41=false], [$WERROR])
=>AX_CHECK_COMPILE_FLAG([-msse4.1], [sse41=false], [sse41=false], [$WERROR])
AX_CHECK_COMPILE_FLAG([-mavx2], [avx2=true], [avx2=false], [$WERROR])
=>AX_CHECK_COMPILE_FLAG([-mavx2], [avx2=false], [avx2=false], [$WERROR])
PKG_CHECK_MODULES([libcurl], [libcurl], [have_libcurl=true], [have_libcurl=false])
=>PKG_CHECK_MODULES([libcurl], [libcurl], [have_libcurl=false], [have_libcurl=false])
copy fix_opendir_INODE64.c to leptonica/src
include file to leptonica/sarray1.c
#include "fix_opendir_INODE64.c"
Step 7 Fix 'curl/curl.h' file not found (Because the curl already included so this step may be not neccessary, but in case you have such error please replace my curl lib with your own curl lib)
download curl https://curl.haxx.se/download.html
then configure it to a another destination folder
./configure --prefix=/path/to/destination/
`xcode-select -p`/usr/bin/make -sj8
`xcode-select -p`/usr/bin/make install
copy file lib/lcurl.a to dependencies/lib
copy curl src folder to dependencies/include/curl
Run make in libtiff-ios folder
Run make in foot folder
configure: error: C++ compiler cannot create executables
For example:
cd /Users/trung.nv/Desktop/trungnv/demo/tesseract-ios/make/tesseract-4.1.1/x86_64-apple-darwin ; \
ln -s /Users/trung.nv/Desktop/trungnv/demo/tesseract-ios/make/leptonica-1.79.0/src/ leptonica ; \
../configure --host=x86_64-apple-darwin --prefix=`pwd` --enable-shared=no --disable-graphics
copy the error command to another terminal tab and run
brew link --overwrite --dry-run leptonica
Fix "fatal error: 'allheaders.h' file not found", remember to specify version of tesseract and leptonica installed
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/leptonica/1.79.0/lib/pkgconfig" PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/tesseract/4.1.1/lib/pkgconfig"
https://github.com/kenticomartinh/Tesseract-OCR-iOS/tree/4.1 https://github.com/tesseract-ocr/tesseract