Possible ABI change in R 4.0.1

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

Possible ABI change in R 4.0.1

Gábor Csárdi
Hi all,

it seems that from R 4.0.1 EXTPTR_PTR can be either a macro or a
function, depending on whether USE_RINTERNALS is requested.

Jeroen helped me find that this was in 78592:
https://github.com/wch/r-source/commit/c634fec5214e73747b44d7c0e6f047fefe44667d

This is a problem, because binary packages that are built on R 4.0.1
or R 4.0.2 will potentially not load on R 4.0.0, if they use the
EXTPTR_PTR function.

E.g. this is R 4.0.0 on Linux:

> library(Rcpp)
Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file,
DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/library/Rcpp/libs/Rcpp.so':
  Error relocating /usr/local/lib/R/library/Rcpp/libs/Rcpp.so:
EXTPTR_PTR: symbol not found
In addition: Warning message:
package ‘Rcpp’ was built under R version 4.0.1

It is easiest to reproduce this on Windows, because the CRAN binaries
are now built on R 4.0.2, so if you install Rcpp on R 4.0.0 from CRAN,
and try to load it you'll get:

> library(Rcpp)
Error: package or namespace load failed for 'Rcpp' in inDL(x,
as.logical(local), as.logical(now), ...):
 unable to load shared object
'C:/Users/csard/R/win-library/4.0/Rcpp/libs/x64/Rcpp.dll':
  LoadLibrary failure:  The specified procedure could not be found.
In addition: Warning message:
package 'Rcpp' was built under R version 4.0.2

I suppose this change was not intended?

Best,
Gabor

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: [External] Possible ABI change in R 4.0.1

luke-tierney
EXTPTR_PTR is not in the API so it is not guaranteed to even exist in
the future. The API function for accessing the pointer address is
R_ExternalPtrAddr. See Section 5.13 in WRE.

Sometimes internals need to be changed, In this case a change was made
to deal with a segfault; the commit notice tells you the PR this
addressed.

As it says in Writing R Extensions about defining USE_RINTERNALS:

     Also be prepared to adjust your code should R internals change.

The same goes for any use of non-API macros and functions.

Best,

luke


On Mon, 29 Jun 2020, Gábor Csárdi wrote:

> Hi all,
>
> it seems that from R 4.0.1 EXTPTR_PTR can be either a macro or a
> function, depending on whether USE_RINTERNALS is requested.
>
> Jeroen helped me find that this was in 78592:
> https://github.com/wch/r-source/commit/c634fec5214e73747b44d7c0e6f047fefe44667d
>
> This is a problem, because binary packages that are built on R 4.0.1
> or R 4.0.2 will potentially not load on R 4.0.0, if they use the
> EXTPTR_PTR function.
>
> E.g. this is R 4.0.0 on Linux:
>
>> library(Rcpp)
> Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file,
> DLLpath = DLLpath, ...):
> unable to load shared object '/usr/local/lib/R/library/Rcpp/libs/Rcpp.so':
>  Error relocating /usr/local/lib/R/library/Rcpp/libs/Rcpp.so:
> EXTPTR_PTR: symbol not found
> In addition: Warning message:
> package ‘Rcpp’ was built under R version 4.0.1
>
> It is easiest to reproduce this on Windows, because the CRAN binaries
> are now built on R 4.0.2, so if you install Rcpp on R 4.0.0 from CRAN,
> and try to load it you'll get:
>
>> library(Rcpp)
> Error: package or namespace load failed for 'Rcpp' in inDL(x,
> as.logical(local), as.logical(now), ...):
> unable to load shared object
> 'C:/Users/csard/R/win-library/4.0/Rcpp/libs/x64/Rcpp.dll':
>  LoadLibrary failure:  The specified procedure could not be found.
> In addition: Warning message:
> package 'Rcpp' was built under R version 4.0.2
>
> I suppose this change was not intended?
>
> Best,
> Gabor
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
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