IULib installation error

38 views
Skip to first unread message

nandhu...@gmail.com

unread,
Apr 7, 2009, 10:07:07 AM4/7/09
to ocropus, nandh...@inteleants.com
Hi ,
i am in new in ocropus , i tried to intall ocropus in my
windows xp machine. following http://groups.google.com/group/ocropus/web/compiling-ocropus-on-windows
but i have intalled below steps but i got error in iulib
installation .

i am getting error in $ make
if g++ -DPACKAGE_NAME=\"iulib\" -DPACKAGE_TARNAME=\"iulib\" -
DPACKAGE_VERSION=\"0.3\" -DPACKAGE_STRING=\"iulib\ 0.3\" -
DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"iulib\" -DVERSION=\"0.3\" -
DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -
DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -
DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -
DHAVE_UNISTD_H=1 -DHAVE_FLOAT_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDINT_H=1 -
DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_WCHAR_H=1 -
DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DHAVE_LIBTIFF=1 -
Dvfork=fork -DHAVE_DUP2=1 -DHAVE_MEMSET=1 -DHAVE_SQRT=1 -
DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRRCHR=1 -I. -I. -I./colib -I./
imgio -I./imglib -g -O2 -MT autoinvert.o -MD -MP -MF ".deps/
autoinvert.Tpo" -c -o autoinvert.o `test -f './imgio/autoinvert.cc' ||
echo './'`./imgio/autoinvert.cc; \
then mv -f ".deps/autoinvert.Tpo" ".deps/autoinvert.Po"; else rm -f
".deps/autoinvert.Tpo"; exit 1; fi
In file included from ./colib/narray-util.h:39,
from ./colib/colib.h:45,
from ./imgio/autoinvert.cc:27:
./colib/compat.h:47:1: warning: "NAN" redefined
In file included from ./colib/narray-ops.h:33,
from ./colib/colib.h:44,
from ./imgio/autoinvert.cc:27:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/math.h:
296:1: warning: this is the location of the previous definition
In file included from ./colib/narray-util.h:39,
from ./colib/colib.h:45,
from ./imgio/autoinvert.cc:27:
./colib/compat.h:51:1: warning: "isnan" redefined
In file included from ./colib/narray-ops.h:33,
from ./colib/colib.h:44,
from ./imgio/autoinvert.cc:27:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/math.h:
398:1: warning: this is the location of the previous definition
In file included from ./colib/narray-util.h:39,
from ./colib/colib.h:45,
from ./imgio/autoinvert.cc:27:
./colib/compat.h:61: error: expected unqualified-id before "sizeof"
./colib/compat.h:61: error: expected `)' before "sizeof"
./colib/compat.h:61: error: expected `)' before "sizeof"
In file included from ./colib/colib.h:45,
from ./imgio/autoinvert.cc:27:
./colib/narray-util.h: In function `void colib::fill_uniform
(colib::floatarray&, float, float)':
./colib/narray-util.h:243: error: `drand48' was not declared in this
scope
make: *** [autoinvert.o] Error 1

any one please tell sollution

namefunnel

unread,
Apr 8, 2009, 2:17:46 PM4/8/09
to ocropus
I've installed iulib on my Windows system but did not run into these
problems. I am by no means an expert on OCRopus or open source
software, but one line that doesn't look right is the following
excerpt from your log:

> ./colib/compat.h:47:1: warning: "NAN" redefined
> In file included from ./colib/narray-ops.h:33,
> from ./colib/colib.h:44,
> from ./imgio/autoinvert.cc:27:
> C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/math.h:
> 296:1: warning: this is the location of the previous definition
> In file included from ./colib/narray-util.h:39,
> from ./colib/colib.h:45,
> from ./imgio/autoinvert.cc:27:

Note that there appears to be a conflict between an iulib include file
and a MinGW file. I did NOT use MinGW when I compiled on my Vista
system. MinGW attempts to provide native Windows library functions to
GNU compiled programs. This is not what you want - the OCRopus code
is Linux-based and is not compatible with Windows libraries. You want
to install cygwin (I'd install just about everything from cygwin),
then compile within that environment. This will link against a set of
libraries that simulate a Unix/Linux environment on a Windows
platform. No MinGW libraries should be involved, and so the errors
you are getting should not occur.

I have tried to compile iulib using a full Windows environment and
libraries (Visual Studio 2005) but there are a lot of references to
Unix/Linux-only functions, and it would take significant work to port
to code that would compile under MinGW or Visual Studio.

Good luck!

namefunnel

unread,
Apr 8, 2009, 3:01:42 PM4/8/09
to ocropus
It's taken a lot of trial and error for me to install OCRopus under
Windows. Perhaps it would help to me to list the key steps that I
remember:

1) Install the full cygwin environment - this will take a lot of space
and time but it's worth it. You will need all the GNU compiler tools
(gcc, g++, ar, ranlib, gdb, make, etc.) plus other stuff like the
Netpbm image conversion routines (portions of OCRopus use image file
formats can only be understood by Netpbm routines). Note that on my
machine (Vista 64-bit), g++ points to the version 3.4.4 of the GNU C++
compiler by default, but compiling openFST will require using later
versions within cygwin.

2) Download the iulib library, untar (I use Winzip 12.0). Bring up a
bash shell (you ought to configure your .bashrc scripts to provide
command aliases that you like), and run:
./configure
make
make install

3) Download OCRopus 0.3.1 (do not use the svn version)

4) Download Tesseract 2.0.3, untar. You will need to patch viewer/
svutil.cpp:

#include <netinet/in.h>

just before the line:

#include <pthread.h>

You also need to run a patch that is contained in the OCRopus main
directory (this is described in the INSTALL file in OCRopus). You
need to be in the tesseract-2.03 directory for this to work.

patch -p1 <../ocropus-0.3/tesseract-2.03-patch.diff # check
this path!

Now run
./configure
make
make install

5) I tried to compile openFST on Windows. I got it to compile by
using command line arguments to configure to use the version 4.xxx GNU
compilers (on my machine these appear to be named gcc4 and g++4), but
I was not able to use the resulting installation with OCRopus because
the scripts that use FST assume that the include files are in a
different place than the latest openFST installs to. Fortunately, you
do not need FST, leptonica, or SDL to use OCRopus.

6) Compile OCRopus by:
./configure --without-fst --without-leptonica --without-SDL
make
make install
make check
The "check" target runs a bunch of tests. The ones that depend on FST
won't run (that's OK). One of the others has a minor error on my
system (one bounding box has a different size than expected).
7) You can test the result by running (from the OCRopus directory in
bash):
ocroscript recognize data/pages/alice_1.png >out_alice.html
ocroscript recognize data/pages/snark01.png >out_snark.html
This uses the recognize.lua script in /usr/local/share/ocroscript/
scripts.

I'm stuck on the next step, namely figuring out how to use this
package and to modify it while working on a Windows platform. Visual
Studio won't work with this code, of course. I've tried Eclipse C++,
but I keep getting weird errors when I attempt to run the make file
within the Eclipse environment - I think this may be due to
incompatibilities between Windows file paths (e.g. D:\ocropus-0.3\...
vs. Linux file paths /cygdrive/d/ocropus-0.3/...)

Currently I can run ocroscript from within "ddd", a visual debugger
that runs on top of X-windows and gdb. To use this, you first have to
start the Xterm server from cygwin. Then ddd runs in an Xterm client
(included with cygwin). Unfortunately, I haven't yet figured out how
to set breakpoints in the OCRopus code in the layout analysis routines
that will actually trigger when I run ocroscript (I can only get
breakpoints to work in code modules like ocroscript.cc and
ocrotoplevel.cc). It think that the problem has to do with the fact
that ocroscript doesn't call the C++ code directly, but instead runs a
LUA interpreter that links to the libocropus.a library.

Anyway, there are a lot of "main" C++ programs included in the OCRopus
system, spread out across quite a number of directories. I have not
yet figured out, however, which of these is a "real" main. All the
ones I've looked at so far import a file that is supposed to contain
intermediate results from earlier processing, and then outputs another
file with more calculations added to it. Also these files are not
built by the Makefile that ships with OCRopus.

Also many of the LUA scripts don't appear to work with the latest
version of OCRopus, and I can't find any documentation that explains
what any of the scripts are doing or why they are different. I'm
working through the code to figure this out, but the mapping between C+
+ routines and LUA calls is not in any documentation that I've seen
yet, and it's not completely straightforward.

Of course, I've only been puzzling over this for a few days and I'm
sure I'll figure out a lot more over the next few days.

Good luck!
Reply all
Reply to author
Forward
0 new messages