Tesseract error while building training tools related to uchar.h file and ICU version

Issue

I have tried to follow the tutorials from here to build training tools for Tesseract. I get this error.

depbase=`echo boxchar.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -DNDEBUG -DPANGO_ENABLE_ENGINE -I../../src/api -I../../src/api -I../../src/ccmain -I../../src/ccutil -I../../src/ccstruct -I../../src/lstm -I../../src/arch -I../../src/viewer -I../../src/textord -I../../src/dict -I../../src/classify -I../../src/wordrec -I../../src/cutil  -I/usr/local/include/leptonica   -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/uuid -I/usr/include/libdrm    -g -O2 -std=c++11 -MT boxchar.lo -MD -MP -MF $depbase.Tpo -c -o boxchar.lo boxchar.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -DNDEBUG -DPANGO_ENABLE_ENGINE -I../../src/api -I../../src/api -I../../src/ccmain -I../../src/ccutil -I../../src/ccstruct -I../../src/lstm -I../../src/arch -I../../src/viewer -I../../src/textord -I../../src/dict -I../../src/classify -I../../src/wordrec -I../../src/cutil -I/usr/local/include/leptonica -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/uuid -I/usr/include/libdrm -g -O2 -std=c++11 -MT boxchar.lo -MD -MP -MF .deps/boxchar.Tpo -c boxchar.cpp  -fPIC -DPIC -o .libs/boxchar.o
boxchar.cpp: In member function 'void tesseract::BoxChar::GetDirection(int*, int*) const':
boxchar.cpp:66:42: error: 'U_RIGHT_TO_LEFT_ISOLATE' was not declared in this scope
         dir == U_ARABIC_NUMBER || dir == U_RIGHT_TO_LEFT_ISOLATE) {
                                          ^
make[1]: *** [boxchar.lo] Error 1
make[1]: Leaving directory `/home/vmuser/ocrd-train-master/tesseract-fd492062d08a2f55001a639f2015b8524c7e9ad4/src/training'
make: *** [training] Error 2

I looked at this Github comment here which states:

http://source.icu-project.org/repos/icu/tags/release-52-1/icu4c/source/common/unicode/uchar.h
http://source.icu-project.org/repos/icu/tags/release-50-1-2/icu4c/source/common/unicode/uchar.h

The training tools need icu version 52 and up. The icu version in RHEL & CentOS 7 is 50.

And from locate uchar.h I found that it resides in /usr/include/uchar.h and
/usr/include/unicode/uchar.h

I am not sure which file to change now. I don’t know if it seems like a really stupid question

Thanks in Advance.

Solution

So, I finally figured it out myself:

download icu packages from:
http://download.icu-project.org/files/icu4c/

I used this file: http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz

After that

tar zxf (tar file)
cd icu/source
make
sudo make install

After this in the Tesseract Directory

make training
sudo make training-install

Answered By – forever

Answer Checked By – Dawn Plyler (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.