Custom Windows compilation problems (Custom Paths)

35 views
Skip to first unread message

Arnaud Loyer

unread,
Jun 27, 2018, 9:27:28 AM6/27/18
to tesseract-ocr

Hello.


I'm desperately trying to compile Tesseract-ocr (4.0) on a Windows Machine with some restrictions.

  • We are doing multi-platforms : an automated compilation must be possible (command-line)
  • We are using specific 3rd party libraries : the compilation must accept custom path / libraries for most of its dependencies
  • We are already using most of the 3rd party libraries for other part of the code : the compilation must not recompile them (thus, no cppan)
  • Leptonica has been built with our special 3rdparty (ZLib, LibPng ..)
  • Our project must "include" tesseract alongside theses specific 3rdparty

Problem :

I have strong issue specifying custom paths for Tesseract. Under Unix (CentOS, Ubuntu 16/18, Debian 8/9 ..), I was able to achieve my goal with the tools autogen autoconf autoheaders pkg-config.

Under Windows, autoconf-archive and pkg-config are unavailable (from what I know) ; making autoconf unusable. I was neither able to compile using CMake and specifying a custom path for Leptonica.


Under Linux :

  1. Merging libraries ZLib/LibPng/LibTiff/LibJpeg with Leptonica (ar)
  2. Creating a modified pkg-config with the path to this modified liblept.a
  3. autogen.sh
  4. LIBLEPT_HEADERSDIR=`pwd`/Leptonica/include ./configure --prefix=`pwd`/install --with-extra-libraries=PATH/TO/LEPTONICA PKG_CONFIG_PATH=PATH/TO/PKG LDFLAGS="-LPATH/TO/LEPTONICA" CPPFLAGS="-IPATH/TO/ZLIB -IPATH/TO/LIBPNG ..."
  5. make


Under Windows :

  1. Trying with pkg-config : installation of pkg-config with mingw failed
  2. Trying with cppan + cmake visual studio : could not figure how to separate cppan from tesseract in the project
  3. Trying with cmake, CMAKE_PREFIX_PATH, CMAKE_MODULE_PATH, Leptonica_DIR : missing config files from Leptonica (LeptonicaConfig.cmake or leptonica-config.cmake)
  4. Trying under Linux Ubuntu 16 with gcc-mingw-w64 : failed to link against tesseract and leptonica libraries under Windows (new Visual project) 


I can detail any of theses steps if you need further information.


Is there any way to simply specify the path to Leptonica include/lib with cmake ?

Is there any restriction for the compilation to look only for an include folder and a library ?

Did you planned users to compile with non-default libraries ? 


Thank you in advance.

Arnaud LOYER.

Reply all
Reply to author
Forward
0 new messages