I followed the steps in https://github.com/tesseract-ocr/tesseract/wiki/Compiling#linux
I downloaded from https://github.com/tesseract-ocr/tesseract zip file.
OS: Centos 7
Compiler: gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
I found error written so I installed autoconf-archive and in order to resolve error with "Leptonica 1.74" I have done:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LIBLEPT_HEADERSDIR=/usr/local/include
export TESSDATA_PREFIX='/usr/local/share/'
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
but I receive this error:
In file included from rect.h:28:0,
from coutln.h:26,
from stepblob.h:23,
from werd.h:28,
from blobbox.h:25,
from blobbox.cpp:25:
blobbox.h: In member function 'void TO_BLOCK::print_rows()':
blobbox.h:737:61: error: expected ')' before 'PRId32'
tprintf("Row range (%g,%g), para_c=%g, blobcount=%" PRId32 "\n",
^
../ccutil/tprintf.h:31:39: note: in definition of macro 'tprintf'
^
make[2]: * [blobbox.lo] Error 1
make[2]: Leaving directory /home/webuser/src/tesseract-4.0/ccstruct' make[1]: [all-recursive] Error 1 make[1]: Leaving directory/home/webuser/src/tesseract-4.0'
make: ** [all] Error 2
Can you help me?
thanks
Did you run autogen.sh again after installing autoconf-archive?
Seems to be related to this change:
https://github.com/tesseract-ocr/tesseract/pull/905/commits/ef1d9600b1#diff-f65400671330df624f228888e8ee46ba
@oscaroxy The master branch is the development branch for 4.0 alpha. Please try to build using a commit before the one mentioned by @amitdo .
I follow your actual advice, I restart then I done:
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract
./autogen.sh
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LIBLEPT_HEADERSDIR=/usr/local/include
export TESSDATA_PREFIX='/usr/local/share/'
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
I obtain:
In file included from rect.h:28:0,
from coutln.h:26,
from stepblob.h:23,
from werd.h:28,
from blobbox.h:25,
from blobbox.cpp:25:
blobbox.h: In member function 'void TO_BLOCK::print_rows()':
blobbox.h:737:61: error: expected ')' before 'PRId32'
tprintf("Row range (%g,%g), para_c=%g, blobcount=%" PRId32 "\n",
^
../ccutil/tprintf.h:31:39: note: in definition of macro 'tprintf'
#define tprintf(...) tprintf_internal(__VA_ARGS__)
^
make[2]: * [blobbox.lo] Error 1
make[2]: Leaving directory /home/webuser/src/tesseract/ccstruct'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory/home/webuser/src/tesseract'
make: * [all] Error 2
thanks
OS: Centos 7
Compiler: gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
I have built only on ubuntu, not centos. Maybe there are differences in the o/s causing the issue.
Since now you have downloaded source using git clone, you can use git to go back to an older commit and try the build there.
git reset --hard 2008dafa7310970002302083659575819e57bb67
will take you back to a commit about 4 days back before the commit @amitdo referred to.
you can give the following command to verify
git log -1
Please try your build there again.
I installed tesseract 3.05 (because other version previous one the 3.05 I don't find) and all it's ok, but so isn't the version 4.0 ready?
thanks
4.0 can be compiled without an error by the continuous integration tests, in several of my test environments and by other people, too. So we need your help to find what is special in your case.
Could you have a look at the file ccstruct/.deps/blobbox.Plo? It must include an entry /usr/include/inttypes.h. That file defines the PRId32 macro.
Try also a simplified build like this:
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract
./autogen.sh
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure
make
From checking for similar error messages it appears that CentOS 7 and a few other versions of CentOS only define the PRId32 macro when the macro #define __STDC_FORMAT_MACROS 1 is set. @oscaroxy, check if manually passing this via CPPFLAGS='-D__STDC_FORMAT_MACROS=1' resolves the issue.
It's not clear to me where Tesseract actually includes
Discussion of this issue in other projects:
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/FyaFYXyzZeU
stweil, I done more, that is:
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract
./autogen.sh
./configure
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LIBLEPT_HEADERSDIR=/usr/local/include
export TESSDATA_PREFIX='/usr/local/share/'
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
but nothing... same error:
In file included from rect.h:28:0,
from coutln.h:26,
from stepblob.h:23,
from werd.h:28,
from blobbox.h:25,
from blobbox.cpp:25:
blobbox.h: In member function 'void TO_BLOCK::print_rows()':
blobbox.h:737:61: error: expected ')' before 'PRId32'
tprintf("Row range (%g,%g), para_c=%g, blobcount=%" PRId32 "\n",
^
../ccutil/tprintf.h:31:39: note: in definition of macro 'tprintf'
#define tprintf(...) tprintf_internal(__VA_ARGS__)
^
make[2]: * [blobbox.lo] Error 1
make[2]: Leaving directory /home/webuser/src/tesseract/ccstruct'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory/home/webuser/src/tesseract'
make: * [all] Error 2
I'm sorry Mr. jbarlow83, I didn't understand your advice, I don't know What to do, where do I pass CPPFLAGS='-D__STDC_FORMAT_MACROS=1' ?
Where do I see where Centos 7 set "#define __STDC_FORMAT_MACROS 1"?
thanks
Try this:
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract
./autogen.sh
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure CXXFLAGS="-D__STDC_FORMAT_MACROS=1"
make
I follow your step and replace "make" with LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make.
anything is to right, now I've (tesseract -v):
tesseract 4.00.00alpha
leptonica-1.74.1
libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.5.13 : libtiff 4.0.5 : zlib 1.2.7
Found AVX
Found SSE
Only in order to understand, is the param CXXFLAGS="-D__STDC_FORMAT_MACROS=1" local to configure tesseract? do it don't interact with other config, right?
thanks
We have two options:
1) Fix this issue (only relevant when the system glibc < 2.18)
2) Document the solution with the environment variable.
I'd fix the issue by always setting __STDC_FORMAT_MACROS (that won't harm for newer glibc).
For the future, the format macros (also REFFORMAT) could be avoided by using C++ code instead of C format strings.
Would including cinttypes instead of inttypes.h also fix the problem?
In fact:
ldd (GNU libc) 2.17
I resolve with __STDC_FORMAT_MACROS, but if I update glib, is it better?
Excuse me, stweil, but you haven't reply my question... thanks
"Only in order to understand, is the param CXXFLAGS="-D__STDC_FORMAT_MACROS=1" local to configure tesseract? do it don't interact with other config, right?"
How do I include cinttypes? where do I find this file? where I put this file?
thanks
do it don't interact with other config, right?
Right.
How do I include cinttypes?
Change file ccutil/host.h and replace the text inttypes.h by cinttypes.
Done, the replace work fine. Which is the better solution?
__STDC_FORMAT_MACROS in configure or the replace?
do the 2 solution change something in the ocr by tesseract?
thanks
do the 2 solution change something in the ocr by tesseract?
No.
Done, the replace work fine. Which is the better solution?
__STDC_FORMAT_MACROS in configure or the replace?
I think using cinttypes is the better solution for C++ code like it is used in Tesseract.
Done in pull request #927.
I prepared definitions of Docker containers and scripts that helps to compile and run Tesseract 4, take look at this: https://github.com/tesseract-shadow/tesseract-ocr-compilation
@wildloop Thanks!
I have added the info on wiki page at https://github.com/tesseract-ocr/tesseract/wiki/4.0-Dockerfile
I have successful build on Centos: 7.3.1611
please reference: https://ivanzz1001.github.io/records/post/ocr/2017/09/08/tesseract-install
Most helpful comment
4.0 can be compiled without an error by the continuous integration tests, in several of my test environments and by other people, too. So we need your help to find what is special in your case.
Could you have a look at the file
ccstruct/.deps/blobbox.Plo? It must include an entry/usr/include/inttypes.h. That file defines thePRId32macro.Try also a simplified build like this: