[R] installing package in Windows

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Mar 8 22:18:47 CET 2000

On Wed, 8 Mar 2000, Karl W. Broman wrote:

> Could you help me in getting a package to compile from source in Windows?
> I'm running Windows NT 4.0 on a pentium 450 with 128 Mb of Ram.  I've got R
> 1.0.0.
> I am developing a package for R which includes a bit of C code.  I have things
> working in Unix just fine, and now I want to port it to Windows NT.  
> I've been following the instructions in the R complements to Venables and
> Ripley's book, "Building from a source-code library under Windows."  I
> installed cygwin-20 and gcc-2.95.2, and ran "make pkg-qtl" (qtl is the name of
> the package).  

The documentation in rw1000sp.zip is the current set, and is more detailed
that in those complements.

> That part works just fine.  But then when I run "make pkgcheck-qtl" I get the
> following error.
> ======================================================================
> bash-2.02$ make pkgcheck-qtl
> -------- Testing package qtl --------
> Running examples in 'qtl-Ex.R' ...
> /Programs/R/rw1000/bin/rterm --vanilla R_LIBS="/Programs/R/rw1000/library;" < qtl-Ex.R > qtl-Ex.Rout
> make[1]: *** [run] Error 1
> make: *** [pkgcheck-qtl] Error 2
> bash-2.02$
> ======================================================================

Do look at the output to see what the error was.

> If, after a long sigh, I run Rgui and just cross my fingers.  Then the first
> time I do "library(qtl)", I get the following error.  (No surprise, given the
> above.) 
> ======================================================================
> > library(qtl)
> Error in dyn.load(x, as.logical(local), as.logical(now)) : 
>         unable to load shared library "E:\Programs\R\rw1000/library/qtl/libs/qtl.dll":
>   LoadLibrary failure
> > library(qtl)
> >
> ======================================================================
> When I type "library(qtl)" a second time, I don't get an error, and all of the
> R functions which do not call C routines run just fine, though the ones with C
> routines give an error like "...C/Fortran function name not in load table."
> Any hints on what I should fiddle with next, or what I read next?

We need to find out why you can't load this. One common reason is that
your DLL depends on some other DLL that it can't find.  And one common
cause for that if you used cygwin-b20 is that you managed to compile
against the cygwin1.dll.  You did have MkRules set up for CYGNUS not

The simplest way to find out if dependencies are the problem is to look at
the DLL with pedump, a free program you should be able to find on the net
(it keeps moving).  You can make things work that are compiled against
cygwin1.dll, but you need to put it in your global path.

The only other reason we know of for problems is Win95-specific, and is
solved by using the cygwin ld.exe.

If that does not help can you send me the complete compile and link log
and the dll?

> One other thing...the "R.h" include file doesn't seem to include the
> "R_ext/PrtUtil.h", where Rprintf is defined.  If I wish to use Rprintf, should
> I include the latter file; should it have been included in R.h?

Yes, no (and the Writing R Extensions manual should mention this). There
are other things in that file that should not be included unless necessary.

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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list