duncantl / Rtesseract

Interface to tesseract OCR system.
12 stars 4 forks source link

MAC-Linux Compatibility #1

Closed abresler closed 9 years ago

abresler commented 9 years ago

Was hoping to try to the package but doesn't appear to install on a Mac/Linux. Is that just me? If not are you looking towards potentially making this cross OS compatible? Looks like a fantastic package!

dsidavis commented 9 years ago

Hi Can you post the complete output of R CMD INSTALL Rtesseract (or install.packages()). It does install on OSX and Linux for me, but it may need some adaptations for other setups.

abresler commented 9 years ago

I just realized I didn't install tesseract correctly; trying again and will share the results; if it doesnt work I will share that and let you know. Thanks for the quick response! ᐧ


Alex Bresler abresler@asbcllc.com

​www.asbcllc.com​

917-455-0239 ​ (cell)​

@abresler http://twitter.com/abresler | LinkedIn http://www.linkedin.com/in/abresler | My Musings http://asbcllc.com/blog

On Fri, Jun 12, 2015 at 10:43 AM, dsidavis notifications@github.com wrote:

Hi Can you post the complete output of R CMD INSTALL Rtesseract (or install.packages()). It does install on OSX and Linux for me, but it may need some adaptations for other setups.

— Reply to this email directly or view it on GitHub https://github.com/duncantl/Rtesseract/issues/1#issuecomment-111515809.

abresler commented 9 years ago

Ok I just installed teserra and it installed ok the package tells me what I need to do, any idea how to do this

Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable

but here is the full output

devtools::install_github("duncantl/Rtesseract")
Downloading GitHub repo duncantl/Rtesseract@master
Installing Rtesseract
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/0n/qhktf1j96b112pf4d6hm2qch0000gn/T/RtmpXHs9WL/devtools1bee2a4cb24d/duncantl-Rtesseract-d5b7318'  \
  --library='/Users/alexbresler/Library/R/3.2/library' --install-tests 

* installing *source* package ‘Rtesseract’ ...
checking for pkg-config... /usr/local/bin/pkg-config
Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
Compiling readImage
readImg.cpp:1:10: fatal error: 'tesseract/baseapi.h' file not found
#include <tesseract/baseapi.h>
         ^
1 error generated.
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/imageCapabilities.R
** libs
clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -I/usr/local/Cellar/leptonica/1.72/include/leptonica    -fPIC  -mtune=core2 -O3    -c confidence.cpp -o confidence.o
confidence.cpp:1:10: fatal error: 'tesseract/baseapi.h' file not found
#include <tesseract/baseapi.h>
         ^
1 error generated.
make: *** [confidence.o] Error 1
ERROR: compilation failed for package ‘Rtesseract’
* removing ‘/Users/alexbresler/Library/R/3.2/library/Rtesseract’
Error: Command failed (1)
> devtools::install_github("duncantl/Rtesseract")
Downloading GitHub repo duncantl/Rtesseract@master
Installing Rtesseract
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/0n/qhktf1j96b112pf4d6hm2qch0000gn/T/RtmpXHs9WL/devtools1bee57d017c4/duncantl-Rtesseract-d5b7318'  \
  --library='/Users/alexbresler/Library/R/3.2/library' --install-tests 

* installing *source* package ‘Rtesseract’ ...
checking for pkg-config... /usr/local/bin/pkg-config
Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
Compiling readImage
readImg.cpp:1:10: fatal error: 'tesseract/baseapi.h' file not found
#include <tesseract/baseapi.h>
         ^
1 error generated.
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/imageCapabilities.R
** libs
clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -I/usr/local/Cellar/leptonica/1.72/include/leptonica    -fPIC  -mtune=core2 -O3    -c confidence.cpp -o confidence.o
confidence.cpp:1:10: fatal error: 'tesseract/baseapi.h' file not found
#include <tesseract/baseapi.h>
         ^
1 error generated.
make: *** [confidence.o] Error 1
ERROR: compilation failed for package ‘Rtesseract’
* removing ‘/Users/alexbresler/Library/R/3.2/library/Rtesseract’
Error: Command failed (1)
abresler commented 9 years ago

So I reinstalled tessera using brew which seemed to work better but now I get a new error:

devtools::install_github("duncantl/Rtesseract")
Downloading GitHub repo duncantl/Rtesseract@master
Installing Rtesseract
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/0n/qhktf1j96b112pf4d6hm2qch0000gn/T/RtmpXHs9WL/devtools1bee60a1b22b/duncantl-Rtesseract-d5b7318'  \
  --library='/Users/alexbresler/Library/R/3.2/library' --install-tests 

* installing *source* package ‘Rtesseract’ ...
checking for pkg-config... /usr/local/bin/pkg-config
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
Compiling readImage
testing leptonica can read different image formats
jpg support
tiff support
libpng warning: iCCP: known incorrect sRGB profile
png support
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/imageCapabilities.R
** libs
clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -I/usr/local/Cellar/leptonica/1.72/include/leptonica   -g -O2 -g -O2 -DHAVE_CONFIG_H -I/usr/local/Cellar/tesseract/3.02.02_3/include/tesseract -I/usr/local/include/leptonica  -fPIC  -mtune=core2 -O3    -c confidence.cpp -o confidence.o
clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -I/usr/local/Cellar/leptonica/1.72/include/leptonica   -g -O2 -g -O2 -DHAVE_CONFIG_H -I/usr/local/Cellar/tesseract/3.02.02_3/include/tesseract -I/usr/local/include/leptonica  -fPIC  -mtune=core2 -O3    -c ext.cpp -o ext.o
ext.cpp:396:41: error: no member named 'c_str' in 'STRING'
        return(ScalarString( mkChar(str.c_str() ) ) );
                                    ~~~ ^
ext.cpp:444:27: error: no member named 'GetInputName' in 'tesseract::TessBaseAPI'; did you mean 'SetInputName'?
    const char * w = api->GetInputName() ;
                          ^~~~~~~~~~~~
                          SetInputName
/usr/local/include/tesseract/baseapi.h:116:8: note: 'SetInputName' declared here
  void SetInputName(const char* name);
       ^
ext.cpp:444:40: error: too few arguments to function call, single argument 'name' was not specified
    const char * w = api->GetInputName() ;
                     ~~~~~~~~~~~~~~~~~ ^
/usr/local/include/tesseract/baseapi.h:116:3: note: 'SetInputName' declared here
  void SetInputName(const char* name);
  ^
ext.cpp:463:39: error: no member named 'GetDatapath' in 'tesseract::TessBaseAPI'
    return(ScalarString( mkChar( api->GetDatapath() ) ) );
                                 ~~~  ^
ext.cpp:471:32: error: no member named 'GetSourceYResolution' in 'tesseract::TessBaseAPI'; did you mean 'SetSourceResolution'?
    return(ScalarInteger( api->GetSourceYResolution() ) );
                               ^~~~~~~~~~~~~~~~~~~~
                               SetSourceResolution
/usr/local/include/tesseract/baseapi.h:332:8: note: 'SetSourceResolution' declared here
  void SetSourceResolution(int ppi);
       ^
ext.cpp:471:53: error: too few arguments to function call, single argument 'ppi' was not specified
    return(ScalarInteger( api->GetSourceYResolution() ) );
                          ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/include/tesseract/baseapi.h:332:3: note: 'SetSourceResolution' declared here
  void SetSourceResolution(int ppi);
  ^
6 errors generated.
make: *** [ext.o] Error 1
ERROR: compilation failed for package ‘Rtesseract’
* removing ‘/Users/alexbresler/Library/R/3.2/library/Rtesseract’
Error: Command failed (1)
dsidavis commented 9 years ago

What version of clang++ and tesseract do you have? Can you post the output from the two shell commands below

% clang++ --version clang version 3.5.0 (tags/RELEASE_350/final) Target: x86_64-apple-darwin13.4.0 Thread model: posix % pkg-config --modversion tesseract 3.03

abresler commented 9 years ago

for #1

Alexs-MacBook-Pro:pl alexbresler$ clang++ --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

for #2

Alexs-MacBook-Pro:pl alexbresler$ pkg-config --modversion tesseract
3.02.02
dsidavis commented 9 years ago

Most of the errors are due to using tesseract 3.02 and not 3.03. I can change the code to work conditionally. However, I found that one feature (getting recognition probabilities) didn't work with 3.02. So you might consider installing 3.03. I built it from source.

abresler commented 9 years ago

Thanks let me try that again -- do you mind sharing how you went about building from source?


Alex Bresler abresler@asbcllc.com

​www.asbcllc.com​

917-455-0239 ​ (cell)​

@abresler http://twitter.com/abresler | LinkedIn http://www.linkedin.com/in/abresler | My Musings http://asbcllc.com/blog

On Fri, Jun 12, 2015 at 12:22 PM, dsidavis notifications@github.com wrote:

Most of the errors are due to using tesseract 3.02 and not 3.03. I can change the code to work conditionally. However, I found that one feature (getting recognition probabilities) didn't work with 3.02. So you might consider installing 3.03. I built it from source.

— Reply to this email directly or view it on GitHub https://github.com/duncantl/Rtesseract/issues/1#issuecomment-111543283.

dsidavis commented 9 years ago

Sure. Download the .tar.gz for the release candidate. This is available at https://drive.google.com/folderview?id=0B7l10Bj_LprhQnpSRkpGMGV2eE0&usp=sharing

Then tar zxf tesseract-3.03-rc1.tar.gz cd tesseract-3.03 ./configure make

Hopefully the configuration step will find leptonica, etc. from your earlier installation.

abresler commented 9 years ago

Maybe getting closer but now I am getting this error again

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

Any idea how to set the pkg_config_path?

dsidavis commented 9 years ago

Did you install tesseract into /usr/local or into your home directory? I forgot to add the make install command at the end. If you are installing into /usr/local/ you will need sudo make install

Then you can set the PKG_CONFIG_PATH to export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Similarly, if you installed tesseract into some place in your home directory, you'd replace /usr/local/ with the directory into which you specified ./configure --prefix=path_to_install_to

abresler commented 9 years ago

Home let me try this


Alex Bresler abresler@asbcllc.com

​www.asbcllc.com​

917-455-0239 ​ (cell)​

@abresler http://twitter.com/abresler | LinkedIn http://www.linkedin.com/in/abresler | My Musings http://asbcllc.com/blog

On Fri, Jun 12, 2015 at 1:30 PM, dsidavis notifications@github.com wrote:

Did you install tesseract into /usr/local or into your home directory? I forgot to add the make install command at the end. If you are installing into /usr/local/ you will need sudo make install

Then you can set the PKG_CONFIG_PATH to export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Similarly, if you installed tesseract into some place in your home directory, you'd replace /usr/local/ with the directory into which you specified ./configure --prefix=path_to_install_to

— Reply to this email directly or view it on GitHub https://github.com/duncantl/Rtesseract/issues/1#issuecomment-111568037.

abresler commented 9 years ago

You sir are an F'ING ROCKSTAR!!!!!