[R] Lazy-loading db setup in the R build process

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Dec 16 13:58:01 CET 2004


Simon Pickering <S.G.Pickering at bath.ac.uk> writes:

> Hi All,
> 
> I have read the article on lazy-loading in the September R news letter, and
> think I have at least a vague grasp on what is happening.
> 
> Am I right in thinking that, assuming I were using the same packages, I
> could copy the .rdb & .rdx files from one installation of R (2.0.0) to
> another? 
> 
> I ask this as I'm trying to cross-compile R (for ARM), and need to use R
> itself to perform the lazy-loading db setup (and probably other things) as
> part of the build process. Therefore I build a native version of R (x86) and
> pass the path of the native R binary as R_EXE in the arm cross-build
> Makefiles (in src/library and its sub-directories).
> 
> This fails with the following error:
> 
> | make[3]: Entering directory
> `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library/base'
> | building package 'base'
> | mkdir -p -- ../../../library/base/demo mkdir -p -- 
> | ../../../library/base/man Error in eval(expr, envir, enclos) : may 
> | already be using lazy loading on base Execution halted
> | make[3]: *** [all] Error 1
> | make[3]: Leaving directory
> `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library/base'
> | make[2]: *** [R] Error 1
> | make[2]: Leaving directory
> `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library'
> | make[1]: *** [R] Error 1
> | make[1]: Leaving directory
> `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src'
> | make: *** [R] Error 1
> 
> My guess is that as the native version has already been built (and enabled
> lazy-loading, etc.), it's not happy that I'm trying to enable it again.
> Might this be the case?
> 
> If so I can see a couple of possible options and I wonder if someone could
> comment on what may or may not be possible to remedy the problem:
> 
> * Run the native binary without loading its various database files (is this
> is possible)
> 
> * Delete the native database files so they can't be used and will be rebuilt
> for the arm version without complaint
> 
> * Simply copy the database files from the native build to the appropriate
> locations in the cross-build (after patching the Makefiles to remove the
> references to R_EXE), assuming that they should be portable across
> architectures?

The last one might work (try it and see). A little experiment,
replacing Opteron base.rdb/rdx files with i386 counterparts indicated
no immediate (!) ill effects.

The (first) thing that seems to bite your cross compile is in
src/library/base/makebasedb.R:

    baseFileBase <- file.path(.Library,"base","R","base")

    if (file.info(baseFileBase)["size"] < 20000) # crude heuristic
        stop("may already be using lazy loading on base");

in which .Library refers to the running R process, and you probably
want the cross-build library instead. I'm not sure that is the only
place that needs changing though. (It *looks* like the tools for
non-base packages take an argument that would allow the build library
to be distinct from the the one used by the running R).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list