[Rd] Installing and compiling C code for R-windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 10 18:26:13 CET 2009


Having PP.o and PP.so will break things if (as I suspect) they are 
from a different architecture.  Your colleague's testing should have 
picked that up (R CMD check will warn you) but you can try deleting 
them.

Also, I think you have ignored all the comments about not installing R 
into a path with spaces in if you want to compile packages -- although 
it usually works, we do not support it.

On Tue, 10 Nov 2009, Hartley, Andrew wrote:

> Hi r-devers,
>
> This is the first time I've tried to install a package from source on
> Windows, so please bear with me. I'm trying to install a package written
> (and tested) by a colleague in C for R on linux, and I am trying to
> install it on windows following the directions here -
> http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset
> and here - http://www.murdoch-sutherland.com/Rtools/
>
> I installed Rtools (but not InnoSetup or LaTeX because of permissions
> problems on my PC, although I don't think they are essential). I checked
> my environment variables are pointing to the correct tools, and then I
> ran the following:
>
> R CMD INSTALL --library="C:/R/library" --no-chm PP

--no-chm is obsolete: are you perchance not using a current version of 
R (see the posting guide)?

> The package is called PP, and contains the following files:
>> ls -R PP
> PP:
> DESCRIPTION  R  man  src  svn-commit.tmp~
>
> PP/R:
> PP.R
>
> PP/man:
> PP.Rd             pp.get.longs.Rd  pp.ppw.Rd    pp.strip.extra.Rd
> pp.close.file.Rd  pp.open.file.Rd  pp.print.Rd  pp.write.Rd
> pp.get.lats.Rd    pp.ppa.Rd        pp.read.Rd   tmp
>
> PP/src:
> PP.c  PP.o  PP.so  makefile.old
>
> The result is (based on my limited knowledge) quite promising, but it
> seems to be unable to link libraries. Here's what I get:
>
> * Installing *source* package 'PP' ...
> ** libs
>  making DLL ...

The hint is here: there is no sign that PP.c was compiled.

> gcc -shared -s -o PP.dll tmp.def PP.o -LC:/PROGRA~1/R/R-29~1.2/bin -lR
> Cannot export SwapEndian: symbol not found
> Cannot export close_file_c: symbol not found
> Cannot export open_file_c: symbol not found
> ..... Etc ....
>
> I don't have any experience compiling C code, so I'm a bit stumped. Do I
> need to override the default gcc settings by editing the makefile? Or
> have I missed something more obvious? Please let me know if you need any
> additional info.
>
> Kind regards,
> Andy
>
>
>
> 	[[alternative HTML version deleted]]

-- 
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-devel mailing list