ropensci / tesseract

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

small PR to use cpp11 #66

Closed pachadotdev closed 1 month ago

pachadotdev commented 3 months ago

this PR here does not introduce breakage, but it works under the assumption that we have tesseract >= 5 the real change here is src/ + DESCRIPTION the rest is roxygen changes and modifications to pass all checks with devtools

pachadotdev commented 3 months ago

the modification to the CI pipeline is to avoid this:

/usr/include/tesseract/baseapi.h:228:7: note:   candidate expects 10 arguments, 8 provided
tesseract.cpp: In function ‘cpp11::logicals validate_params(cpp11::strings)’:
tesseract.cpp:91:74: error: cannot convert ‘std::string*’ {aka ‘std::__cxx11::basic_string<char>*’} to ‘STRING*’
   91 |     out[i] = api->GetVariableAsString(std::string(params.at(i)).c_str(), &str);
      |                                                                          ^~~~
      |                                                                          |
      |                                                                          std::string* {aka std::__cxx11::basic_string<char>*}

this is the opposite of the problem I had with Rcpp in the cluster, it shows the same with Tesseract 5 and this error with cpp11 happens on Ubuntu with Tesseract 4 installed

I shall try to write a code that works with v4 and v5 later

pachadotdev commented 3 months ago

Hi @jeroen this PR works well with tesseract 4 and 5, this is my solution to install tesseract on Mac and Windows laptops today that had Tesseract 4. I made sure it works with Tesseract 5 on Linux, that is what I have on my laptop.

pachadotdev commented 2 months ago

@jeroen I went back to the original CI script and it works, but it also works if I install Tesseract 5 to test with Ubuntu

pachadotdev commented 1 month ago

hi @jeroen The CI now works well with Tesseract 4 and 5 on Ubuntu. I am using my fork in the Niagara cluster, for which I have to run "rsync -av --update" from my laptop provided that the cluster has a very restricted internet connection, and it works well there :)