jergavin / python-tesseract

Automatically exported from code.google.com/p/python-tesseract
0 stars 0 forks source link

Problems with centos + python tesseract #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Install leptonica from source
2.Install tesseract from source (checkout from repo)
3.Install (altinstall) python2.7 along python2.4 in Centos 5.8 
_>Then do as follows:(includes output)

python2.7 config.py --prefix=/usr
OUTPUT:NOTHING
____________________________________________

running: python2.7 setup.py clean
OUTPUT:
os=linux
Current Version : only
===========['stdc++', 'tesseract', 'lept']===========
running clean
____________________________________________
running: python2.7 setup.py build
OUTPUT:
os=linux
Current Version : only
===========['stdc++', 'tesseract', 'lept']===========
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying tesseract.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_tesseract' extension
swigging tesseract.i to tesseract_wrap.cpp
swig -python -c++ -I/usr/include/tesseract -I/usr/include/leptonica -o 
tesseract_wrap.cpp tesseract.i
/usr/include/tesseract/publictypes.h:78: Warning 462: Unable to set 
dimensionless array variable
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -I. -I/usr/include/tesseract -I/usr/include/leptonica 
-I/usr/local/include/python2.7 -c tesseract_wrap.cpp -o 
build/temp.linux-x86_64-2.7/tesseract_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
Ada/C/ObjC but not for C++
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -I. -I/usr/include/tesseract -I/usr/include/leptonica 
-I/usr/local/include/python2.7 -c main_dummy.cpp -o 
build/temp.linux-x86_64-2.7/main_dummy.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
Ada/C/ObjC but not for C++
main_dummy.h:16: error: variable or field ‘SetCvImage’ declared void
main_dummy.h:16: error: ‘PyObject’ was not declared in this scope
main_dummy.h:16: error: ‘o’ was not declared in this scope
main_dummy.h:16: error: expected primary-expression before ‘*’ token
main_dummy.h:16: error: ‘api’ was not declared in this scope
main_dummy.h:16: error: initializer expression list treated as compound 
expression
main_dummy.cpp:171: error: ‘PyObject_HEAD’ does not name a type
main_dummy.cpp:173: error: ISO C++ forbids declaration of ‘PyObject’ with 
no type
main_dummy.cpp:173: error: expected ‘;’ before ‘*’ token
main_dummy.cpp:177: error: ‘PyTypeObject’ does not name a type
main_dummy.cpp:184: error: ‘PyObject’ was not declared in this scope
main_dummy.cpp:184: error: ‘o’ was not declared in this scope
main_dummy.cpp:185: error: expected ‘,’ or ‘;’ before ‘{’ token
main_dummy.cpp:190: error: ‘PyObject’ was not declared in this scope
main_dummy.cpp:190: error: ‘o’ was not declared in this scope
main_dummy.cpp:191: error: expected ‘,’ or ‘;’ before ‘{’ token
main_dummy.cpp:200: error: ‘PyObject’ was not declared in this scope
main_dummy.cpp:200: error: ‘o’ was not declared in this scope
main_dummy.cpp:200: error: ‘IplImage’ was not declared in this scope
main_dummy.cpp:200: error: ‘dst’ was not declared in this scope
main_dummy.cpp:200: error: initializer expression list treated as compound 
expression
main_dummy.cpp:201: error: expected ‘,’ or ‘;’ before ‘{’ token
main_dummy.cpp:184: warning: ‘is_none’ defined but not used
main_dummy.cpp:190: warning: ‘is_iplimage’ defined but not used
main_dummy.cpp:200: warning: ‘convert_to_IplImage’ defined but not used
error: command 'gcc' failed with exit status 1

What version of the product are you using? On what operating system?

Latest 0.7 , centos5.8
Please provide any additional information below.
The following line uses the correct directories 
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -I. -I/usr/include/tesseract -I/usr/include/leptonica 
-I/usr/local/include/python2.7 -c main_dummy.cpp -o 
build/temp.linux-x86_64-2.7/main_dummy.o

I hope you can help, i didn't want to send a ticket cause I am guessing it's a 
pretty specific problem but i am going crazy with this setup right now so i 
need some help -and no, changing OS is not an option sadly)

Original issue reported on code.google.com by rs.AllW...@gmail.com on 7 Aug 2012 at 7:25

GoogleCodeExporter commented 9 years ago
I have added the wiki for Centos
http://code.google.com/p/python-tesseract/wiki/HowToCompilePythonTesseractForCen
tos

If u find it useful, buy me a coffee pls

Original comment by FreeT...@gmail.com on 8 Aug 2012 at 8:58

GoogleCodeExporter commented 9 years ago
WOW, thanks so much. I will try it out asap and let you know how it went -and 
yes, i will buy you a coffee too -. 

Original comment by rs.AllW...@gmail.com on 9 Aug 2012 at 12:43

GoogleCodeExporter commented 9 years ago
Hi, Free
I just tried your step by step guide for Centos on my EC2 AMI instance, which 
is basically a centos. 
I find many points in your guide not accurate and not executable, and well, in 
the end, I failed to compile python-tesseract :( 

please allow me to make some amendments:
1. use `sudo` before `yum`, `cp` commands
2. for installation of opencv 2.4.2, patch is not working and `sed -i.bak 
's|libdir=|libdir=/usr/lib64|g' unix-install/opencv.pc` does not make sense 
because there is no such file as "unix-install/opencv.pc"
3. in latest tesseract,  ` --with-libdir=lib64` is no longer a valid option for 
`configure`
4. for commands like `cp -Rf *opencv* /usr/lib64`, I don't quite understand, 
why not `ln -sf`? is that a big deal?
5. most importantly for me, I cannot get python-tesseract to build... It gave 
me 
     main_dummy.cpp:22:21: fatal error: tprintf.h: No such file or directory

I checked my /usr/include/tesseract, there is no such file. 

Sorry I am new to all these,  and I cannot solve this problem on my own, could 
you please help me out of this? and maybe fix the doc as well for others? 

Thank you for your great work! Eagerly looking forward to your response.

Original comment by vincent....@gmail.com on 28 Nov 2012 at 2:35

GoogleCodeExporter commented 9 years ago
Fixed 
https://code.google.com/p/python-tesseract/wiki/HowToCompilePythonTesseractForCe
ntos

Original comment by FreeT...@gmail.com on 10 Dec 2012 at 4:51

GoogleCodeExporter commented 9 years ago
Hi,

Did vincent get a fix to the EC2 AMI install ?

I too am following instrucitons and I'm getting the same error when running the 
python setup.py

Please help me as I am so close :-)

Error Message:

$ sudo python setup.py build
os=linux
Current Version : tesseract
===========['stdc++', 'tesseract', 'lept', 'opencv_core']===========
aaaaaaaaaaaaaaaaaaaaaaaaaaa
['.', '/usr/local/include/tesseract', '/usr/local/include/leptonica', 
'/usr/local/include/opencv2']
running build
running build_py
copying tesseract.py -> build/lib.linux-x86_64-2.6
running build_ext
building '_tesseract' extension
swigging tesseract.i to tesseract_wrap.cpp
swig -python -c++ -I/usr/local/include/tesseract -I/usr/local/include/leptonica 
-o tesseract_wrap.cpp tesseract.i
/usr/local/include/tesseract/publictypes.h:78: Warning 462: Unable to set 
dimensionless array variable
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I/usr/local/include/tesseract 
-I/usr/local/include/leptonica -I/usr/local/include/opencv2 
-I/usr/include/python2.6 -c tesseract_wrap.cpp -o 
build/temp.linux-x86_64-2.6/tesseract_wrap.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I/usr/local/include/tesseract 
-I/usr/local/include/leptonica -I/usr/local/include/opencv2 
-I/usr/include/python2.6 -c main_dummy.cpp -o 
build/temp.linux-x86_64-2.6/main_dummy.o
In file included from /usr/include/python2.6/pyconfig.h:6:0,
                 from /usr/include/python2.6/Python.h:8,
                 from config.h:9,
                 from main_dummy.cpp:9:
/usr/include/python2.6/pyconfig-64.h:1034:0: warning: "_POSIX_C_SOURCE" 
redefined [enabled by default]
/usr/include/features.h:162:0: note: this is the location of the previous 
definition
/usr/include/python2.6/pyconfig-64.h:1043:0: warning: "_XOPEN_SOURCE" redefined 
[enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous 
definition
main_dummy.cpp:22:21: fatal error: tprintf.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

Original comment by alangunn...@gmail.com on 25 Jan 2013 at 1:10

GoogleCodeExporter commented 9 years ago
Hi, 

Solved it after with help of this post:
http://code.google.com/p/python-tesseract/issues/detail?id=20#c14

All i needed to do was
sudo cp ~/tesseract/tesseract-ocr/ccutil/tprintf.h /usr/local/include/tesseract

Original comment by alangunn...@gmail.com on 25 Jan 2013 at 2:10