[R-pkg-devel] Two versions of package DLL?

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Mon Feb 8 14:27:28 CET 2021


I'd like to install two versions of the rgl package DLL, with the 
.onLoad hook choosing which one to load.  Can anyone tell me of another 
package that does this successfully?

Here's the background:

Some MacOS users of rgl can't load it.  I think this is because of 
problems with XQuartz on their machines.  (See 
https://github.com/dmurdoch/rgl/issues/11 for a couple of reports.)  I 
don't know if these users are using the new cpus or what else might be 
causing their problems.

I've set it up to allow users to skip everything related to X11 by 
specifying --disable-opengl when installing, and have attempted to make 
it do this automatically when configuring:  so I think the problem is 
solved for users who can install rgl from source.

I'd like to try to make a solution for users who can't build it, by 
installing two copies of the DLL: the regular one linked to the X11 
libraries, and one built with the --disable-opengl option.

This is somewhat similar to how things were handled on MacOS up to 2015, 
when a second DLL was built to use Apple's AGL, while the default used 
GLX.  I resurrected that old code and modified it for the current use, 
and it works, but generates two check issues:

1. The Makevars file had various GNU-isms.  I'd really like to see a 
successful package that does this without them, but I guess I can 
declare that it uses GNU make if I have to.

2. Routine registration seems to think the second DLL (called "nullrgl") 
is in a different package, so I get warnings like:

❯ checking foreign function calls ... WARNING
   Foreign function calls to a different package:
     .C(rgl_abclines, ...)
     .C(rgl_addtosubscene, ...)

     ...

     .Call(rgl_setWheelCallback, ...)
   Undeclared package in foreign function calls:
      ‘nullrgl’

I am pretty sure this is a false positive in the checks, e.g. printing 
rgl_abclines shows this:


 > rgl:::rgl_abclines
$name
[1] "rgl_abclines"

$address
<pointer: 0x7f994a00f330>
attr(,"class")
[1] "RegisteredNativeSymbol"

$dll
DLL name: nullrgl
Filename:
 
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rgl/libs/nullrgl.so
Dynamic lookup: FALSE

$numParameters
[1] 4

attr(,"class")
[1] "CRoutine"         "NativeSymbolInfo"

The code in QC.R (here: 
https://github.com/wch/r-source/blob/8cf68878a1361d00ff2125db2e1ac7dc8f6c8009/src/library/tools/R/QC.R#L2118) 
looks at the "DLL name", and ignores the fact that the path to the DLL 
is in the rgl libs directory.  I'll try to put together a patch for R 
that fixes this.

Duncan Murdoch



More information about the R-package-devel mailing list