Skip to content

Possible bug or annoyance with library.dynam.unload()

7 messages · Karl Forner, Duncan Murdoch, Romain Francois

4 days later
#
On 21/09/2010 10:38 AM, Karl Forner wrote:
I'd probably post instructions for a reproducible example first.  Pick 
some CRAN package, tell us what to do with it to trigger the error, and 
then we can see if it's something special about your package or Roxygen 
or a general problem.

Duncan Murdoch
#
Thanks Duncan for your suggestion.

I could not find any package using dynamic library, namespaces and not the
useDynLib pragma so
I created a minimalistic package to demonstrate the problem.
Please find attached a very small package foo (8.8k)

Steps to reproduce the problem:

* unarchive it ( tar zxvf foo_0.1.tar.gz )
* cd foo
* install it locally ( mkdir local; R CMD INSTALL -l local . )
* R
# there you should be able to see the foo.so lib, in my case
/x05/people/m160508/workspace/foo/local/foo/libs/foo.so
.onUnload, libpath= local/fooWarning message:
.onUnload failed in unloadNamespace() for 'foo', details:
  call: library.dynam.unload("foo", libpath)
  error: shared library 'foo' was not loaded

#The libpath that the .onUnload() gets is "local/foo".

#This fails:
Error in library.dynam.unload("foo", "local/foo") :
  shared library 'foo' was not loaded

# but if you use the absolute path it works:
Karl
On Tue, Sep 21, 2010 at 5:33 PM, Duncan Murdoch <murdoch.duncan at gmail.com>wrote:

            
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo_0.1.tar.gz
Type: application/x-gzip
Size: 9010 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20100922/4787d39a/attachment.gz>
#
On 22/09/2010 11:22 AM, Karl Forner wrote:
Your package depends on Rcpp, so I didn't try it in the alpha version of 
2.12.0 (Rcpp isn't available there in a Windows binary at the moment), 
but I did try it in R-patched.  With one minor change to your script 
(the lib.loc needs to be "local", not "local/" on Windows), I can 
reproduce the problem, and it looks like a bug to me.  Thanks for the 
report, I'll put it on the bugs page, and hopefully it will be fixed 
before the 2.12.0 release.

Duncan Murdoch
#
Le 22/09/10 17:31, Duncan Murdoch a ?crit :
(This might be moot given Karl's answer), but:

We are working on having Rcpp to work with R 2.12.0, we have currently a 
few issues to deal with due to the use of a newer compiler for R 2.12.0.

We hope we can make this happen before R 2.12.0 is out next month.

Romain