[Rd] Trouble building package using R in development

Henrik Bengtsson hb at biostat.ucsf.edu
Wed Jan 16 18:03:14 CET 2013


On Wed, Jan 16, 2013 at 8:59 AM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:
> On Wed, Jan 16, 2013 at 7:25 AM, Gavin Simpson <gavin.simpson at ucl.ac.uk> wrote:
>> As a follow-up, shortly after I clicked send I decided to do something
>> silly and rename my ~/.Renviron (which set R_LIBS too). Silly because
>> the Writing R Extensions (WRE) manual says that these startup files are
>> not read as R is invoked with --vanilla.
>>
>> Once I renamed ~/.Renviron so it was not being read I was able to build
>> the package using R Under Development following the remaining
>> instructions in the WRE note [1]
>>
>> So I do wonder if I have misunderstood the note in WRE or if there is
>> some other issue here? Starting R --vanilla with R Under Development
>> wasn't reading ~/.Renviron, and by renaming ~/.Renviron that I was able
>> to build the package indicates that this file was implicated in the
>> problem I described.
>>
>> Is it intentional that R CMD build reads ~/.Renviron ? If it is, then
>> WRE should ideally clarify this or make it explicit. If it wasn't
>> supposed to be read, is there a bug here?
>
> FYI, related posts:
>
> * Rd thread 'R devel [and R 2.14.1 patched]: R CMD build now sources
> ~/.Rprofile' on Feb 23, 2012
> [https://stat.ethz.ch/pipermail/r-devel/2012-February/063365.html]
> * Rd thread 'R CMD build/check on Windows 7' on Jul 17, 2012
> [https://stat.ethz.ch/pipermail/r-devel/2012-July/064427.html]
>
> To circumvent this, I check using:
>
> R --no-init-file CMD check foo_1.0.tar.gz

Should have clarified that in your case you need to add '--no-environ'.

/Henrik

>
> /Henrik
>
>>
>> All the best,
>>
>> Gavin
>>
>> [1]
>> http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Checking-and-building-packages
>>
>> On Wed, 2013-01-16 at 16:05 +0100, Gavin Simpson wrote:
>>> 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
>> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list