ropensci / tesseract

Bindings to Tesseract OCR engine for R
https://docs.ropensci.org/tesseract
245 stars 26 forks source link

Installation error: fatal error: /usr/local/include/leptonica/allheaders.h #58

Closed tedmoorman closed 2 years ago

tedmoorman commented 2 years ago

Here is the output from the failed installation.

> install.packages("tesseract")
Installing package into ‘/projects/CI_Analysts/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package ‘tesseract’ ...
** package ‘tesseract’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/tesseract -I/usr/include/leptonica  
Using PKG_LIBS=-ltesseract  
Using CXX11CPP: g++ -E -std=c++11
** libs
rm -f tesseract.so RcppExports.o tesseract.o
g++ -std=c++11 -I"/opt/R/R-3.5.3/lib64/R/include" -DNDEBUG -I/usr/include/tesseract -I/usr/include/leptonica   -I"/projects/CI_Analysts/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fPIC  -O3 -march=native -Wno-ignored-attributes -c RcppExports.cpp -o RcppExports.o
g++ -std=c++11 -I"/opt/R/R-3.5.3/lib64/R/include" -DNDEBUG -I/usr/include/tesseract -I/usr/include/leptonica   -I"/projects/CI_Analysts/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fPIC  -O3 -march=native -Wno-ignored-attributes -c tesseract.cpp -o tesseract.o
In file included from tesseract.cpp:1:
tesseract_types.h:2:10: fatal error: /usr/local/include/leptonica/allheaders.h: Permission denied
    2 | #include <leptonica/allheaders.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from RcppExports.cpp:4:
tesseract_types.h:2:10: fatal error: /usr/local/include/leptonica/allheaders.h: Permission denied
    2 | #include <leptonica/allheaders.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tesseract.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘tesseract’
* removing ‘/projects/CI_Analysts/R/x86_64-pc-linux-gnu-library/3.5/tesseract’
Warning in install.packages :
  installation of package ‘tesseract’ had non-zero exit status

Here is my sessionInfo:

R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.9 (Maipo)

Matrix products: default
BLAS: /opt/R/R-3.5.3/lib64/R/lib/libRblas.so
LAPACK: /opt/R/R-3.5.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] httr_1.4.2       compiler_3.5.3   magrittr_2.0.1   R6_2.5.1         assertthat_0.2.1 miniCRAN_0.2.14  tools_3.5.3      igraph_1.2.9    
 [9] pkgconfig_2.0.3  renv_0.14.0  

Any help is appreciated.

jeroen commented 2 years ago

Your error says Permission denied so apparently R is unable to read the files you installed in /usr/local/include/leptonica. It looks like you tried to build leptonica from source and messed up the installation?

I would recommend removing your custom installation from /usr/local and instead install tesseract-devel and leptonica-devel from yum. See the readme file

tedmoorman commented 2 years ago

I really appreciate the helpful feedback. Thank you!