Giter Club home page Giter Club logo

Comments (4)

steve-s avatar steve-s commented on August 16, 2024 1

Hello Nathan,

it seems that we've seen this issue before and we believe that this time it is a problem on the side of R package Rcpp used by pdftools. The issue was reported here: RcppCore/Rcpp#935. In the meantime as a workaround you can patch Rcpp sources:

--- a/inst/include/Rcpp/protection/Shelter.h
+++ b/inst/include/Rcpp/protection/Shelter.h
@@ -26,7 +26,7 @@ namespace Rcpp {
         Shelter() : nprotected(0){}
 
         inline SEXP operator()(SEXP x){
-            nprotected++;
+           if ( x != R_NilValue ) nprotected++;
             return Rcpp_protect(x) ;
         }

in case you're not that familiar with R ecosystem: you'll have to download the Rcpp sources (e.g., to ~/Rcpp), apply the patch and then install the patched Rcpp via R CMD INSTALL ~/Rcpp and then re-install pdftools via install.packages("pdftools") so that it's built with the new Rcpp headers.

With the patched version of Rcpp, the provided example gives me:

[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7
[1] 8
[1] 9
[1] 10
[1] 11
<std::runtime_error in poppler_render_page(loadfile(pdf), page, dpi, opw, upw, antialiasing,     text_antialiasing): Invalid page.>
[1] "Yah, finished!"

which seems to be the same as GNU-R.

but it is a work around we were trying for other issues in RC11

if you can, please report those issues as well even if you have a workaround. It will be appreciated. (Including how you worked around the issue would be great too).

from fastr.

NRBPerdijk avatar NRBPerdijk commented on August 16, 2024

The "other issues" for which this is a workaround can all be traced back to #49, so we expect them to disappear with the next GraalVM RC.

Thanks for the local fix of the RCCP-issue. Patching local sources and reinstalling pdftools does indeed make the problem go away! 👍

from fastr.

steve-s avatar steve-s commented on August 16, 2024

FYI, we changed the behavior and FastR is now tolerant to unbalanced protect/unprotect, you only get a warning instead of an error, so if you don't mind that warning, you can use unpatched version of Rcpp.

from fastr.

NRBPerdijk avatar NRBPerdijk commented on August 16, 2024

Good to know!

from fastr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.