From gavin.simpson at ucl.ac.uk  Wed Jan 16 16:05:06 2013
From: gavin.simpson at ucl.ac.uk (Gavin Simpson)
Date: Wed, 16 Jan 2013 16:05:06 +0100
Subject: [Rd] Trouble building package using R in development
Message-ID: <1358348706.4687.25.camel@chrysothemis.geog.ucl.ac.uk>

Dear List,

I'm having considerable trouble setting up my environment (Linux, Fedora
16, Bash) to build and check packages under R Under Development
(r61660). I'm doing this to better get a handle on difference in the
output from running checks on examples in one of my packages. Note I
compiled R Under Development myself

The problem I am now having is whenever I try to build my analogue
package using R Under Development, R complains about a dependency having
been built before R 3.0.0. I obviously don't have my environment
variables set correctly, but I don't see why or how R is finding my
daily-use package library; if anything I would have expected it to fail
with a missing dependency.

If I start Rdevel with --vanilla (to mimic Rdevel CMD build) I see:

> .libPaths()
[1] "/home/gavin/R/devlibs"             "/home/gavin/R/devel/build/library"

the first entry there is because I have temporarily set R_LIBS to that
directory via export R_LIBS=/home/gavin/R/devlibs. From there we see I
have versions of the dependencies installed in this library and they are
built with 3.0.0:

> installed.packages("~/R/devlibs/")[, "Built", drop = FALSE]
              Built  
analogue      "3.0.0"
ctv           "3.0.0"
permute       "3.0.0"
princurve     "3.0.0"
rgl           "3.0.0"
scatterplot3d "3.0.0"
vegan         "3.0.0"

Note that there are no other versions of vegan inadvertently installed
to the build directory for R Under Development.

Following advice in Writing R Extensions I have also created
~/build.Renviron and ~/check.Renviron and as these are non-standard I
also followed the advice to set R_BUILD_ENVIRON and R_CHECK_ENVIRON
again temporarily via export:

$ cat $R_CHECK_ENVIRON
R_LIBS=/home/gavin/R/devlibs

$ cat $R_BUILD_ENVIRON
R_LIBS=/home/gavin/R/devlibs

Yet still I get errors building analogue:

$ Rdevel CMD build ../analogue/pkg/
* checking for file ?../analogue/pkg/DESCRIPTION? ... OK
* preparing ?analogue?:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to re-build vignettes
      -----------------------------------
* installing *source* package ?analogue? ...
** libs
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c c_distx.c -o c_distx.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c c_distxy.c -o c_distxy.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c distx.c -o distx.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c distxy.c -o distxy.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c wastats.c -o wastats.o
gcc -std=gnu99 -shared -L/usr/local/lib64 -o analogue.so c_distx.o c_distxy.o distx.o distxy.o wastats.o
installing to /tmp/Rtmpctxbtv/Rinst30e3f762569/analogue/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error : package ?vegan? was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ?analogue?
* removing ?/tmp/Rtmpctxbtv/Rinst30e3f762569/analogue?
      -----------------------------------
ERROR: package installation failed

Can anyone suggest where to go from here?

TIA

Gavin
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



[Rd] Trouble building package using R in development
Gavin Simpson