[R] (C programming problem on MacOS X)

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 23 08:48:25 CET 2005


Please do INSTALL the package and test loading it before R CMD check.
You will get better errror messages.  This has been discussed on the 
appropriate R list (R-devel, not here), many times.

Since you mention -lgslcblas and no BLAS, my guess is that your shared 
object has unsatisfied entry points.

However, can you not obtain advice locally on R / MacOS X programming: 
your address suggests that you have neighbours who are long-term 
practitioners?

On Thu, 22 Dec 2005, wei sun wrote:

> Hi,
>
> I am new in writing R extension.
> I read the "Writing R Extensions", and search online but just cannot
> find the answer.

You seeem to have failed to find the R posting guide and its request to 
use a proper subject line, not to send HTML mail and to use an appropriate 
list.

> I am trying to add c-code, which depend on GSL C  library, into my R
> package.
> I am using Max OS-X 10.4.3, powerpc-apple-darwin8-gcc-4.0.1
>
> I begin wtih package.skeleton, and then add my c file into folder src
> and then add  file Makevars:
>
> PKG_LIBS=-lgsl -lgslcblas -lm
>
> In the zzz.R file, I add the function .First.lib:
>
> .First.lib <- function(lib, pkg) {
>   library.dynam("anovaGSL", pkg, lib)
> }
>
> I think these two things are enough. then I just run R CMD check
> anovaGSL (my package name)
> followed is the error message:
>
> Error: .First.lib failed for 'anovaGSL'
> Call sequence:
> 2: stop(gettextf(".First.lib failed for '%s'", libraryPkgName(package)),
>        domain = NA)
> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose
> = FALSE)
> Execution halted
> See section 'Generic functions and methods' of the 'Writing R
> Extensions'
> manual.
> * checking replacement functions ... WARNING
> Error: .First.lib failed for 'anovaGSL'
> Call sequence:
> 2: stop(gettextf(".First.lib failed for '%s'", libraryPkgName(package)),
>        domain = NA)
> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose
> = FALSE)
> Execution halted
> In R, the argument of a replacement function which corresponds to the
> right
> hand side must be named 'value'.
> * checking foreign function calls ... WARNING
> Error: .First.lib failed for 'anovaGSL'
> Call sequence:
> 2: stop(gettextf(".First.lib failed for '%s'", libraryPkgName(package)),
>        domain = NA)
> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose
> = FALSE)
> Execution halted
> See section 'System and foreign language interfaces' of the 'Writing R
> Extensions' manual.
> * checking Rd files ... OK
> * checking for missing documentation entries ... ERROR
> Error: .First.lib failed for 'anovaGSL'
>
>
> appreciate any help!!!
>
>
> wei
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list