From f.harrell at vanderbilt.edu  Tue Jun  1 07:48:17 2004
From: f.harrell at vanderbilt.edu (Frank E Harrell Jr)
Date: Tue Jun  1 13:50:51 2004
Subject: [Rd] Problem with .First.lib while running R CMD check
In-Reply-To: <16572.8966.59739.966023@gargle.gargle.HOWL>
References: <40BB6107.5040001@vanderbilt.edu>
	<16572.8966.59739.966023@gargle.gargle.HOWL>
Message-ID: <40BC18A1.5070005@vanderbilt.edu>

Martin Maechler wrote:
>>>>>>"Frank" == Frank E Harrell <f.harrell@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
options(drop.unused.levels=F).

Error in dyn.load(x, as.logical(local), as.logical(now)) :
         unable to load shared library 
"/home/harrelfe/R/Hmisc.Rcheck/Hmisc/libs/Hmisc.so":
   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.

Frank


[Rd] Problem with .First.lib while running R CMD check
Frank E Harrell Jr