Sarkal / python-tesseract

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

Building on Centos 7: invalid conversion from ‘const Pix*’ to ‘Pix*’ #63

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Followed the Centos 6.3 instructions in the wiki up to "python setup.py 
build".
3. That command gives several errors when running it on Centos 7 (CentOS Linux 
release 7.0.1406). See log output below.

$ sudo python setup.py build
Your os is:linux
..........
Current Version : 0.9
os=linux
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
********************************************************************************
********************************************************************************
****************************************
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
ret
~~~cv_pc~~~
{}
[]
===========['stdc++', 'tesseract', 'lept']===========
['.']
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!
mincl='/usr/include/opencv2'

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^
['setup.py', 'build']
running builu
running build_py
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/local/include/leptonica 
-I/usr/include/opencv2 -o tesseract_wrap.cpp tesseract.i
/usr/include/tesseract/pageiterator.h:81: Warning 362: operator= ignored
/usr/include/tesseract/publictypes.h:82: 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-strong --param=ssp-buffer-size=4 
-grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG 
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 
-mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I/usr/include/tesseract 
-I/usr/local/include/leptonica -I/usr/include/opencv2 -I/usr/include/python2.7 
-c tesseract_wrap.cpp -o build/temp.linux-x86_64-2.7/tesseract_wrap.o
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPI_SetImage__SWIG_1(PyObject*, PyObject*)’:
tesseract_wrap.cpp:147829:37: error: invalid conversion from ‘const Pix*’ 
to ‘Pix*’ [-fpermissive]
   (arg1)->SetImage((Pix const *)arg2);
                                     ^
In file included from /usr/include/tesseract/capi.h:5:0,
                 from tesseract_wrap.cpp:3635:
/usr/include/tesseract/baseapi.h:354:8: error:   initializing argument 1 of 
‘void tesseract::TessBaseAPI::SetImage(Pix*)’ [-fpermissive]
   void SetImage(Pix* pix);
        ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPI_ProcessPages__SWIG_0(PyObject*, PyObject*)’:
tesseract_wrap.cpp:148762:86: error: no matching function for call to 
‘tesseract::TessBaseAPI::ProcessPages(const char*, const char*, int&, 
STRING*&)’
   result = (bool)(arg1)->ProcessPages((char const *)arg2,(char const *)arg3,arg4,arg5);
                                                                                      ^
tesseract_wrap.cpp:148762:86: note: candidate is:
In file included from /usr/include/tesseract/capi.h:5:0,
                 from tesseract_wrap.cpp:3635:
/usr/include/tesseract/baseapi.h:534:8: note: bool 
tesseract::TessBaseAPI::ProcessPages(const char*, const char*, int, 
tesseract::TessResultRenderer*)
   bool ProcessPages(const char* filename,
        ^
/usr/include/tesseract/baseapi.h:534:8: note:   no known conversion for 
argument 4 from ‘STRING*’ to ‘tesseract::TessResultRenderer*’
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPI_ProcessPage__SWIG_0(PyObject*, PyObject*)’:
tesseract_wrap.cpp:148978:95: error: no matching function for call to 
‘tesseract::TessBaseAPI::ProcessPage(Pix*&, int&, const char*, const char*, 
int&, STRING*&)’
   result = (bool)(arg1)->ProcessPage(arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7);
                                                                                               ^
tesseract_wrap.cpp:148978:95: note: candidate is:
In file included from /usr/include/tesseract/capi.h:5:0,
                 from tesseract_wrap.cpp:3635:
/usr/include/tesseract/baseapi.h:547:8: note: bool 
tesseract::TessBaseAPI::ProcessPage(Pix*, int, const char*, const char*, int, 
tesseract::TessResultRenderer*)
   bool ProcessPage(Pix* pix, int page_index, const char* filename,
        ^
/usr/include/tesseract/baseapi.h:547:8: note:   no known conversion for 
argument 6 from ‘STRING*’ to ‘tesseract::TessResultRenderer*’
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessTextRendererCreate(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150269:57: error: too few arguments to function 
‘TessResultRenderer* TessTextRendererCreate(const char*)’
   result = (TessResultRenderer *)TessTextRendererCreate();
                                                         ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:101:40: note: declared here
 TESS_API TessResultRenderer* TESS_CALL TessTextRendererCreate(const char* outputbase);
                                        ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessHOcrRendererCreate(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150282:57: error: too few arguments to function 
‘TessResultRenderer* TessHOcrRendererCreate(const char*)’
   result = (TessResultRenderer *)TessHOcrRendererCreate();
                                                         ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:102:40: note: declared here
 TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate(const char* outputbase);
                                        ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessPDFRendererCreate(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150305:74: error: too few arguments to function 
‘TessResultRenderer* TessPDFRendererCreate(const char*, const char*)’
   result = (TessResultRenderer *)TessPDFRendererCreate((char const *)arg1);
                                                                          ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:104:40: note: declared here
 TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(const char* outputbase, const char* datadir);
                                        ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessUnlvRendererCreate(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150320:57: error: too few arguments to function 
‘TessResultRenderer* TessUnlvRendererCreate(const char*)’
   result = (TessResultRenderer *)TessUnlvRendererCreate();
                                                         ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:105:40: note: declared here
 TESS_API TessResultRenderer* TESS_CALL TessUnlvRendererCreate(const char* outputbase);
                                        ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBoxTextRendererCreate(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150333:60: error: too few arguments to function 
‘TessResultRenderer* TessBoxTextRendererCreate(const char*)’
   result = (TessResultRenderer *)TessBoxTextRendererCreate();
                                                            ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:106:40: note: declared here
 TESS_API TessResultRenderer* TESS_CALL TessBoxTextRendererCreate(const char* outputbase);
                                        ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessResultRendererAddError(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150502:53: error: ‘TessResultRendererAddError’ was not 
declared in this scope
   result = (int)TessResultRendererAddError(arg1,arg2);
                                                     ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessResultRendererGetOutput(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150564:74: error: ‘TessResultRendererGetOutput’ was not 
declared in this scope
   result = (int)TessResultRendererGetOutput(arg1,(char const **)arg2,arg3);
                                                                          ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessResultRendererTypename(PyObject*, PyObject*)’:
tesseract_wrap.cpp:150586:51: error: ‘TessResultRendererTypename’ was not 
declared in this scope
   result = (char *)TessResultRendererTypename(arg1);
                                                   ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPISetImage2(PyObject*, PyObject*)’:
tesseract_wrap.cpp:151999:46: error: invalid conversion from ‘const Pix*’ 
to ‘Pix*’ [-fpermissive]
   TessBaseAPISetImage2(arg1,(Pix const *)arg2);
                                              ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:195:26: error:   initializing argument 2 of 
‘void TessBaseAPISetImage2(TessBaseAPI*, Pix*)’ [-fpermissive]
 TESS_API void  TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle, struct Pix* pix);
                          ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPIProcessPages(PyObject*, PyObject*)’:
tesseract_wrap.cpp:152711:91: error: too few arguments to function ‘int 
TessBaseAPIProcessPages(TessBaseAPI*, const char*, const char*, int, 
TessResultRenderer*)’
   result = (char *)TessBaseAPIProcessPages(arg1,(char const *)arg2,(char const *)arg3,arg4);
                                                                                           ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:237:26: note: declared here
 TESS_API BOOL  TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle,  const char* filename, const char* retry_config,
                          ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPIProcessPages1(PyObject*, PyObject*)’:
tesseract_wrap.cpp:152775:94: error: ‘TessBaseAPIProcessPages1’ was not 
declared in this scope
   result = (int)TessBaseAPIProcessPages1(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
                                                                                              ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPIProcessPage(PyObject*, PyObject*)’:
tesseract_wrap.cpp:152848:100: error: too few arguments to function ‘int 
TessBaseAPIProcessPage(TessBaseAPI*, Pix*, int, const char*, const char*, int, 
TessResultRenderer*)’
   result = (char *)TessBaseAPIProcessPage(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6);
                                                                                                    ^
In file included from tesseract_wrap.cpp:3635:0:
/usr/include/tesseract/capi.h:239:26: note: declared here
 TESS_API BOOL  TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle, struct Pix* pix, int page_index, const char* filename,
                          ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessBaseAPIProcessPage1(PyObject*, PyObject*)’:
tesseract_wrap.cpp:152930:103: error: ‘TessBaseAPIProcessPage1’ was not 
declared in this scope
   result = (int)TessBaseAPIProcessPage1(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7);
                                                                                                       ^
tesseract_wrap.cpp: In function ‘PyObject* 
_wrap_TessPageIteratorGetImage(PyObject*, PyObject*)’:
tesseract_wrap.cpp:154309:101: error: cannot convert ‘int*’ to ‘Pix*’ 
for argument ‘4’ to ‘Pix* TessPageIteratorGetImage(const 
TessPageIterator*, TessPageIteratorLevel, int, Pix*, int*, int*)’
   result = (Pix *)TessPageIteratorGetImage((tesseract::PageIterator const *)arg1,arg2,arg3,arg4,arg5);
                                                                                                     ^
error: command 'gcc' failed with exit status 1

Original issue reported on code.google.com by pe...@peterkrantz.se on 4 Aug 2014 at 10:02

GoogleCodeExporter commented 8 years ago
Have u installed opencv?
https://gist.github.com/mitmul/9253702

Original comment by FreeT...@gmail.com on 5 Aug 2014 at 1:02

GoogleCodeExporter commented 8 years ago
Yes, I have built it from source as per the instructions in the wiki page as 
well as installing the RPM but I still get the error above. It seems to be 
built correctly.

Original comment by pe...@peterkrantz.se on 5 Aug 2014 at 8:15

GoogleCodeExporter commented 8 years ago
But....

Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found

Original comment by FreeT...@gmail.com on 5 Aug 2014 at 8:25

GoogleCodeExporter commented 8 years ago
I have PKG_CONFIG_PATH="/usr/lib/pkgconfig" and 

$ ll /usr/lib/pkgconfig/

gives:

-rw-r--r--. 1 root root 951 Aug  4 22:38 opencv.pc
-rw-r--r--. 1 root root 466 Aug  4 23:21 tesseract.pc

Original comment by pe...@peterkrantz.se on 5 Aug 2014 at 8:37

GoogleCodeExporter commented 8 years ago
could you send me a ssh account through my email?

Original comment by FreeT...@gmail.com on 3 Oct 2014 at 4:03

GoogleCodeExporter commented 8 years ago
Same issue here.

Original comment by sean....@gmail.com on 12 Nov 2014 at 9:28

GoogleCodeExporter commented 8 years ago
I have opencv installed and setup.py detects it just fine, but I am getting the 
same "no known conversion for argument 6 from ‘STRING*’ to 
‘tesseract::TessResultRenderer*’" error.  I added the flag "-fpermissive", 
still doesn't work.

Original comment by jpthomps...@gmail.com on 2 Apr 2015 at 10:09

GoogleCodeExporter commented 8 years ago
Here's something that might point you in the right direction:

In tesseract_wrap.cpp, whenever the type of an argument should be 
tesseract::TessResultRenderer* instead of STRING*, just change the mention 
STRING* to tesseract::TessResultRenderer*.  Then I compiled using the following:

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I. 
-I/usr/local/include/tesseract -I/usr/local/include/leptonica 
-I/usr/include/python2.7 -c tesseract_wrap.cpp -o 
build/temp.linux-x86_64-2.7/tesseract_wrap.o -fpermissive -O0 -funroll-loops -g

and I didn't get any errors.  But the real problem is that tesseract_wrap.cpp 
was auto-generated by SWIG, so the bug must be in SWIG!

Original comment by jpthomps...@gmail.com on 2 Apr 2015 at 10:51

GoogleCodeExporter commented 8 years ago
Don't use the svn version right now. 
zdenko makes some changes in the svn version which is a bit tricky to wrap

wget https://tesseract-ocr.googlecode.com/archive/3.03-rc1.tar.gz

Original comment by FreeT...@gmail.com on 3 Apr 2015 at 1:04