Skip to content

Possible ABI change in R 4.0.1

2 messages · Gábor Csárdi, iuke-tier@ey m@iii@g oii uiow@@edu

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