./configure --with-tclap-include=/usr/local/include/tclap --with-openbabel-include=/usr/local/include/openbabel3 --with-openbabel-lib=/usr/local/lib
It is possible to compile OSRA as library (.so).
./configure --enable-lib
export JAVA_HOME=/usr/local/jdk1.6.0_27
./configure --enable-java
Notes:
* JVM looks up the libraries in system-wide directories but also in specified by java.library.path system property. So when starting the java application, make sure this property is properly setup or OSRA library is in system path (/usr/local/lib is usually '''not'''):
:
java -Djava.library.path=/usr/local/lib -cp commons-io-1.4.jar net.sf.osra.OsraLibTest
LD_PRELOAD=/usr/local/lib/libopenbabel.so java ...
yast -i \ gcc-c++ libstdc++-devel \ libGraphicsMagick++2 libGraphicsMagick2 libGraphicsMagick++-devel \ libopenbabel3 libopenbabel-devel libnetpbm-devel libbz2-devel
yast -i libxslt docbook-xsl-stylesheets
# wget -nv 'http://download.opensuse.org/repositories/devel:/libraries:/c_c++/openSUSE_Factory/src/tclap-1.2.0-6.18.src.rpm' # rpm -i tclap-1.2.0-6.18.src.rpm # rpmbuild -ba /usr/src/packages/SPEC/tclap.spec # rpm -i /usr/src/packages/RPMS/i686/tclap-1.2.0-6.18.i686.rpm
# wget -nv 'http://download.opensuse.org/source/distribution/11.2/repo/oss/suse/src/potrace-1.8-84.1.src.rpm' # rpm -i potrace-1.8-84.1.src.rpm # zcat potrace_1.8.suse.patch.gz | patch -d /usr/src/packages -p1 # rpmbuild -ba /usr/src/packages/SPECS/potrace.spec # rpm -i /usr/src/packages/RPMS/i686/{potrace-lib-1.8-84.2.i686.rpm,potrace-devel-1.8-84.2.i686.rpm}
# wget -nv 'https://sourceforge.net/projects/osra/files/contrib/1.3.7/ocrad-0.20-1.0.src.rpm/download' # rpmbuild --rebuild ocrad-0.20-1.0.src.rpm # rpm -i /usr/src/packages/RPMS/i686/ocrad-devel-0.20-1.0.i686.rpm
# wget -nv 'https://sourceforge.net/projects/osra/files/contrib/1.3.7/gocr-0.50-1.0.src.rpm/download' # rpmbuild --rebuild gocr-0.50-1.0.src.rpm # rpm -i /usr/src/packages/RPMS/i686/gocr-devel-0.50-1.0.i686.rpm
# wget -nv 'ftp://rpmfind.net/linux/fedora/development/rawhide/source/SRPMS/cuneiform-1.1.0-4.fc17.src.rpm' # rpmbuild --rebuild cuneiform-1.1.0-4.fc17.src.rpm # rpm -i /usr/src/packages/RPMS/i686/cuneiform{-devel,}-1.1.0-4.i686.rpm # wget -nv 'ftp://rpmfind.net/linux/fedora/development/rawhide/source/SRPMS/tesseract-3.00-2.fc15.src.rpm' # rpmbuild --rebuild tesseract-3.00-2.fc15.src.rpm # rpm -i /usr/src/packages/RPMS/i686/tesseract{-devel,}-3.00-2.i686.rpm
./configure && make all install
To have static libraries install through MacPorts the following:
libxml2, libiconv, zlib, bzip2, freetype, libpng, tiff, lcms, jasper.
Download and compile JPEG. Macports version does not work.
Compile OCRAD and TCLAP as follows:
:./configure;make;sudo make install
Potrace:
:./configure --with-libpotrace --disable-shared; make; sudo make install
GOCR:
:./configure; make libs; sudo make install
OpenBabel:
:export LDFLAGS=/usr/local/lib/libiconv.a
:mkdir build
:cd build
:cmake -DBUILD_SHARED=OFF ..
:sudo make install
GraphicsMagick:
:./configure --disable-shared --with-x=no --disable-openmp --without-threads
:make
:sudo make install
OSRA (assuming you installed static GraphicsMagick libraries and header files in /Users/igor/build):
:./configure --enable-static-linking --disable-graphicsmagick-config --with-graphicsmagick-lib=/Users/igor/build/lib --with-graphicsmagick-include=/Users/igor/build/include/GraphicsMagick
:make
It is possible to compile OSRA using either Cygwin or MinGW environment, however it appears that Cygwin-compiled executable runs about two orders of magnitude slower than a Linux version running on an equivalent class CPU. Therefore it is strongly recommended NOT to use Cygwin to compile OSRA.
Before you compile GraphicsMagick it is necessary to install the pre-requisite libraries - zlib, bzip2, jasper (I was able to compile only version 1.701.0 and not the later 1.900.1), jbigkit, jpeg-6b, lcms (1.19 not lcms2), libpng, tiff (3.8.2, not the later 3.9.3, 3.9.4).
You can read "ADD-ON LIBRARIES & PROGRAMS" for GraphicsMagick which seems to apply to ImageMagick as well.
Whenever "configure" script was available I used the following options:
:./configure --disable-shared LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include
To configure GraphicsMagick I used the following options:
:./configure --disable-shared --without-threads --disable-openmp LDFLAGS=-L/usr/local/lib/ CPPFLAGS=-I/usr/local/include/
Compile and install GraphicsMagick, GOCR (needs "make libs" for library), Potrace (needs ./configure --enable-libpotrace for library), TCLAP, OCRAD.
Compiling OpenBabel version 3.0.0:
First make sure zlib, eigen2, and libxml2 are installed. For libxml2 I used the following
options for configure: --without-threads --disable-shared;
Run cmake with the following options:
cmake.exe -G"MSYS Makefiles" -DZLIB_LIBRARY=/usr/local/lib/libz.a -DZLIB_INCLUDE_DIR=/usr/local/inclulde -DEIGEN2_INCLUDE_DIR=/usr/local/include/eigen2 -DLIBXML2_LIBRARIES=/usr/local/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/usr/local/include/libxml2 -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED=OFF -DCMAKE_CXX_FLAGS=-DLIBXML_STATIC -DCMAKE_C_FLAGS=-DLIBXML_STATIC -DCMAKE_CXX_STANDARD_LIBRARIES=-lws2_32 ../
make
make install
Compiling poppler:
With MinGW one may need to edit poppler-global.h (lines 25-26) to remove dllimport and dllexport defines, also add to gfile.cc "#define _WIN32_WINNT 0x0501"
Compiling osra:
:./configure --with-openbabel-lib=/usr/local/bin --enable-static-linking
:make
Make sure you take a look at osra.bat to see that the environment is set
correctly. You will still need delegates.xml from ImageMagick installation
and a separately installed Ghostscript if you'd like to process PDF and
PostScript files.
Edit the Makefile to set ARCH variable to win32. Running make should (hopefully) generate osra.exe.
You're done!
Note: if you are going to link against certain libraries below statically (--enable-static-linking OSRA configuration option), then you need to choose the corresponding option.
export JAVA_HOME=/cygdrive/c/Java/jdk1.6.0_27
./configure --enable-java --enable-static-linking --disable-graphicsmagick-config
java -Djava.library.path=C:\osra\src -cp commons-io-1.4.jar net.sf.osra.OsraLibTest