[Rd] Problem with .First.lib while running R CMD check

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Jun 1 07:48:17 CEST 2004

Martin Maechler wrote:
>>>>>>"Frank" == Frank E Harrell <f.harrell at vanderbilt.edu>
>>>>>>    on Mon, 31 May 2004 18:44:55 +0200 writes:
>     Frank> I am having difficulty running R CMD check using the
>     Frank> 30May04 version of R-devel and a new version of the
>     Frank> Hmisc package:
>     Frank> * checking S3 generic/method consistency ... WARNING
>     Frank> Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, 
>     Frank> character.only = TRUE, verbose = FALSE) :
>     Frank> .First.lib failed
>     Frank> Execution halted
>     Frank> See section 'Generic functions and methods' of the
>     Frank> 'Writing R Extensions' manual.
> I'm not sure, but I'd guess it's simply the last line of your
> .First.lib. that fails, i.e.,
>     library.dynam("Hmisc", pkg, lib)
> which fails loading the C/Fortran code.
> I've had similar experiences.  The 'R CMD check' error message
> is definitely ``sub optimal''.
> Simply try (in R-devel)
>    library(Hmisc, lib.loc="~/R/Hmisc.Rcheck")
> This should give a much better error message.
> Let us know if this helped.
> Regards, Martin

Thanks Martin.  Here's what I get:

 > library(Hmisc,lib.loc="~/R/Hmisc.Rcheck")
Hmisc library by Frank E Harrell Jr

Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview')
to see overall documentation.

Hmisc redefines [.factor to drop unused levels of factor variables
when subscripting. To prevent this behaviour, issue the command

Error in dyn.load(x, as.logical(local), as.logical(now)) :
         unable to load shared library 
   libR.so: cannot open shared object file: No such file or directory
Error in library(Hmisc, lib.loc = "~/R/Hmisc.Rcheck") :
         .First.lib failed

Since Hmisc.so is in the right place:

~/R/Hmisc.Rcheck/Hmisc/libs harrelfe:ls -la
total 48
drwxr-xr-x    2 harrelfe harrelfe     4096 May 31 18:31 .
drwxr-xr-x   10 harrelfe harrelfe     4096 May 31 18:34 ..
-rwxr-xr-x    1 harrelfe harrelfe    37524 May 31 18:31 Hmisc.so

I don't understand the problem.  The same Hmisc.so (under 
/usr/local/lib/R/site-library) loads fine under R 1.9.


More information about the R-devel mailing list