[Rcpp-devel] Rcpp_precious_remove again (Windows)

Dominick Samperi djsamperi at gmail.com
Fri Jan 20 16:35:17 CET 2023


Thanks Tomas,

After fixing the library issue and getting the app running what happens
when you terminate with q()?

You should see the usual "Save workspace image? [y/n/c]:", and under Linux
this is what happens.

In my testing with the latest R source under Windows this doesn't happen,
but I haven't been able
to build with modified R source to find out why.

Dominick




On Fri, Jan 20, 2023 at 4:28 AM Tomas Kalibera <tomas.kalibera at gmail.com>
wrote:

> On 1/20/23 02:40, Dirk Eddelbuettel wrote:
> > On 19 January 2023 at 19:41, Dominick Samperi wrote:
> > | I narrowed the problem down to the call to R_ReplDLLdo1() in RInside,
> and I
> > | built R-4.3.0 pre-release version for Windows from source to
> investigate
> > | further (online instructions by Tomas Kalibera were very helpful).
> >
> > Yes Tomas is a master of many tools and deep source of tricks and
> general help.
> >
> > | But the problem does not occur with this version of R! Note that the
> problem
> > | did not occur in some older versions of R either.
> > |
> > | This version-dependence may be related to the fact that this function
> and
> > | others used by Rcpp/RInside are not part of the supported API for R,
> so the
> > | underlying implementation details for internals like external pointers
> may
> > | change.
> >
> > Well I probably don't agree here.
> >
> > Because (as per your Subject) 'Rcpp_precious_remove' is in this, as we
> had a
> > bit of transition to get to more effortlessly growing internal objects, I
> > still suspect (as per my first message in this thread) that you may have
> had
> > a cross of 'old' and 'new' approaches. A simple consisten recompilation
> > generally fixes that.  Per the NEWS.Rd we did the finaly clean up (a
> reset)
> > in 1.0.9. (We had improved unwind_protect since just after that release.)
> >
> > But by all means, keep digging and look around if you think something is
> > suspicious there. It could well that we do something wrong on Windows, or
> > have another issue somewhere.  But I remain quite confident that things
> are
> > generally in good working order -- these RInside examples have all been
> > working fine more or less unchanged for close to a decade.
>
> I tried the example sent by Dominick at the start of this thread with
> the current R-devel and Rtools43 and the current Rcpp and RInside. I
> also got the error message "Error: function 'Rcpp_precious_remove' not
> provided by package 'Rcpp'", but it was because R_LIBS was not set.
> After setting it, the program worked.
>
> In more detail, this was my make file:
>
> ----
>
> PKLIB = C:/Users/tomas/AppData/Local/R/win-library/4.3
> RHOME = C:/msys64/home/tomas/ucrt3/r/trunk
>
> INC = -I"$(RHOME)/include" -I"$(PKLIB)/Rcpp/include"
> -I"$(PKLIB)/RInside/include"
>
> LIB = -L"$(RHOME)/bin/x64" -L"$(PKLIB)/RInside/lib/x64" -lRInside -lR
>
> repl: repl.o
>          g++ -o repl repl.o $(LIB)
>
> repl.o: repl.cpp
>          g++ -c -g -std=c++11 $(INC) repl.cpp
>
> clean:
>          rm *.o *.exe
> ---
>
> This was repl.cpp:
>
> ---
>
> #include <RInside.h>                    // for the embedded R via RInside
>
> int main(int argc, char *argv[]) {
>      RInside R(argc, argv, false, false, true); // Create an embedded R
> instance
>
>      std::cout << "[ You can finish the with Ctrl+D ]" << std::endl;
>      R.parseEval("options(prompt = 'R console > ')");
>      R.parseEval("X11()");
>      R.repl() ;
>      R.parseEval("dev.off()");
>      exit(0);
> }
>
> ---
>
> I ran repl.exe from cmd.exe (not the Msys2 bash) so that I could see
> more error messages.
>
> I had to set PATH to make sure R.dll is found by repl.exe. And I had to
> set R_LIBS to make sure Rcpp is found. These settings made it work:
>
> set PATH=%PATH%;C:\msys64\home\tomas\ucrt3\r\trunk\bin\x64
> set R_LIBS=C:\Users\tomas\AppData\Local\R\win-library\4.3
>
> Without these variables set, executing repl.exe gave this error: "The
> code execution cannot proceed because R.dll was not found. ", hence I
> set PATH as above.
>
> Executing then without R_LIBS set gave this error:
>
> "
> Error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'
> In addition: Warning message:
> In library(package, lib.loc = lib.loc, character.only = TRUE,
> logical.return = TRUE,  :
>    there is no package called 'Rcpp'
> "
>
> So I knew I had to set R_LIBS.
>
> Best
> Tomas
>
>
> >
> > Cheers, Dirk
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20230120/f8f55cce/attachment.html>


More information about the Rcpp-devel mailing list