R API for C/C++ initialisation issue appears with update to R.3.5

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

R API for C/C++ initialisation issue appears with update to R.3.5

Andéol Evain
Hello everyone,

I have a C++ program that calls R using R_tryEval, very similarly to what
package RInside does.
It used to work with R.3.4.3 and R.3.4.4. However, since I updated it to
R.3.5.1, R sends an error message: "*Error in < My command > : the base
graphics system is not registered*"  for any command related to the
graphics package.

I made a ticket on stackoverflow about it: https://stackoverflow.com/
questions/51242993/difference-between-r-3-4-4-and-r-3-5-1-in-r-api-for-c

But nobody could explain why so far. And after reducing my code further, I
am now enclined to think this is actually a bug.

The code provided in stackOverflow is already reduced, but not minimal yet.
Since then, I reduced it further to really ensure that it was not an
interference from anything around it. So I removed the GUI and the
callbacks.
Here is a really minimal example attached.

In its current form, the program just sends the command :   par("mar") to
R, and then the command  dev.off()   .
With R.3.4.4, this program print as output what is expected. No error
occured during evaluation of the command :









*No error occured during eval of "par(\"mar\")"EXAMPLE #1 Output: EXAMPLE
#1 Output: Result is:  "5.1"Result is:  "5.1"Result is:  "5.1"Result is:
"5.1"No error occured during eval of "dev.off()"Result is:  "1"*

But the exact same program with R.3.5.1 gives:





*An error occured during eval of "par(\"mar\")"No error occured during eval
of "dev.off()"Result is:  "1"*

The error that occured is not displayed here, since I removed the callbacks
to fetch it, but it was:
*Error in par("mar") : the base graphics system is not registered*


I compiled Microsoft Visual C++ Compiler 15.0 (amd64), and uses 64bits
version of R. But previously I also observed the same behovior with 32bits.
I also tried re-installing R from scratch, without effect.

I am using Windows 10, 64bits
Registry variables PATH and R_HOME are correctly set and points to the
appropriate version of R, installed in the default directory.

I'd be glad to hear any ideas about potential fixes or workaround.

Cheers,

Andéol Evain

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

main.cpp (718 bytes) Download Attachment
rmanager.h (484 bytes) Download Attachment
rmanager.cpp (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: R API for C/C++ initialisation issue appears with update to R.3.5

Tierney, Luke
You might have more luck getting help with a completely self-contained
example (no QT in particular) and a complete description of how you
built and ran your example.

That said, the placement of the call to Rf_endEmbedded looks a little
odd.

Best,

luke

On Thu, 12 Jul 2018, Andéol Evain wrote:

> Hello everyone,
>
> I have a C++ program that calls R using R_tryEval, very similarly to what
> package RInside does.
> It used to work with R.3.4.3 and R.3.4.4. However, since I updated it to
> R.3.5.1, R sends an error message: "*Error in < My command > : the base
> graphics system is not registered*"  for any command related to the
> graphics package.
>
> I made a ticket on stackoverflow about it: https://stackoverflow.com/
> questions/51242993/difference-between-r-3-4-4-and-r-3-5-1-in-r-api-for-c
>
> But nobody could explain why so far. And after reducing my code further, I
> am now enclined to think this is actually a bug.
>
> The code provided in stackOverflow is already reduced, but not minimal yet.
> Since then, I reduced it further to really ensure that it was not an
> interference from anything around it. So I removed the GUI and the
> callbacks.
> Here is a really minimal example attached.
>
> In its current form, the program just sends the command :   par("mar") to
> R, and then the command  dev.off()   .
> With R.3.4.4, this program print as output what is expected. No error
> occured during evaluation of the command :
>
>
>
>
>
>
>
>
>
> *No error occured during eval of "par(\"mar\")"EXAMPLE #1 Output: EXAMPLE
> #1 Output: Result is:  "5.1"Result is:  "5.1"Result is:  "5.1"Result is:
> "5.1"No error occured during eval of "dev.off()"Result is:  "1"*
>
> But the exact same program with R.3.5.1 gives:
>
>
>
>
>
> *An error occured during eval of "par(\"mar\")"No error occured during eval
> of "dev.off()"Result is:  "1"*
>
> The error that occured is not displayed here, since I removed the callbacks
> to fetch it, but it was:
> *Error in par("mar") : the base graphics system is not registered*
>
>
> I compiled Microsoft Visual C++ Compiler 15.0 (amd64), and uses 64bits
> version of R. But previously I also observed the same behovior with 32bits.
> I also tried re-installing R from scratch, without effect.
>
> I am using Windows 10, 64bits
> Registry variables PATH and R_HOME are correctly set and points to the
> appropriate version of R, installed in the default directory.
>
> I'd be glad to hear any ideas about potential fixes or workaround.
>
> Cheers,
>
> Andéol Evain
>

--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R API for C/C++ initialisation issue appears with update to R.3.5

Andéol Evain
Thanks you very much !

I cleaned up all the Qt dependencies to simplify reproducibility, but when
I moved the call to Rf_endEmbedded to the destructor of class RManager
instead of right after the callbacks settings, the issue disappeared.
It still seems a bit weird that this placement of Rf_endEmbedded was ok for
R.3.4, but not for R.3.5. Maybe there used to be some bug that allowed it
to work while it shouldn't.

Andéol

2018-07-12 23:50 GMT+01:00 <[hidden email]>:

> You might have more luck getting help with a completely self-contained
> example (no QT in particular) and a complete description of how you
> built and ran your example.
>
> That said, the placement of the call to Rf_endEmbedded looks a little
> odd.
>
> Best,
>
> luke
>
> On Thu, 12 Jul 2018, Andéol Evain wrote:
>
> Hello everyone,
>>
>> I have a C++ program that calls R using R_tryEval, very similarly to what
>> package RInside does.
>> It used to work with R.3.4.3 and R.3.4.4. However, since I updated it to
>> R.3.5.1, R sends an error message: "*Error in < My command > : the base
>> graphics system is not registered*"  for any command related to the
>> graphics package.
>>
>> I made a ticket on stackoverflow about it: https://stackoverflow.com/
>> questions/51242993/difference-between-r-3-4-4-and-r-3-5-1-in-r-api-for-c
>>
>> But nobody could explain why so far. And after reducing my code further, I
>> am now enclined to think this is actually a bug.
>>
>> The code provided in stackOverflow is already reduced, but not minimal
>> yet.
>> Since then, I reduced it further to really ensure that it was not an
>> interference from anything around it. So I removed the GUI and the
>> callbacks.
>> Here is a really minimal example attached.
>>
>> In its current form, the program just sends the command :   par("mar") to
>> R, and then the command  dev.off()   .
>> With R.3.4.4, this program print as output what is expected. No error
>> occured during evaluation of the command :
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *No error occured during eval of "par(\"mar\")"EXAMPLE #1 Output: EXAMPLE
>> #1 Output: Result is:  "5.1"Result is:  "5.1"Result is:  "5.1"Result is:
>> "5.1"No error occured during eval of "dev.off()"Result is:  "1"*
>>
>> But the exact same program with R.3.5.1 gives:
>>
>>
>>
>>
>>
>> *An error occured during eval of "par(\"mar\")"No error occured during
>> eval
>> of "dev.off()"Result is:  "1"*
>>
>> The error that occured is not displayed here, since I removed the
>> callbacks
>> to fetch it, but it was:
>> *Error in par("mar") : the base graphics system is not registered*
>>
>>
>> I compiled Microsoft Visual C++ Compiler 15.0 (amd64), and uses 64bits
>> version of R. But previously I also observed the same behovior with
>> 32bits.
>> I also tried re-installing R from scratch, without effect.
>>
>> I am using Windows 10, 64bits
>> Registry variables PATH and R_HOME are correctly set and points to the
>> appropriate version of R, installed in the default directory.
>>
>> I'd be glad to hear any ideas about potential fixes or workaround.
>>
>> Cheers,
>>
>> Andéol Evain
>>
>>
> --
> Luke Tierney
> Ralph E. Wareham Professor of Mathematical Sciences
> University of Iowa                  Phone:             319-335-3386
> Department of Statistics and        Fax:               319-335-3017
>    Actuarial Science
> 241 Schaeffer Hall                  email:   [hidden email]
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel