From O.Kullmann at swansea.ac.uk  Sat Oct 13 23:16:00 2012
From: O.Kullmann at swansea.ac.uk (Oliver Kullmann)
Date: Sat, 13 Oct 2012 22:16:00 +0100
Subject: [Rd] installation of R (2.14.1 and 2.15.1) fails due to
 [reg-packages.Rout] Error
Message-ID: <20121013211600.GB3069@csltok.swansea.ac.uk>

Hello,

I'm trying to install R from sources on two Linux machines (both with Suse 12.2):

1.
> uname -a
Linux cs-wsok 3.4.6-2.10-desktop #1 SMP PREEMPT Thu Jul 26 09:36:26 UTC
2012 (641c197) x86_64 x86_64 x86_64 GNU/Linux
2.
> uname -a
Linux csltok.swansea.ac.uk 3.4.6-2.10-desktop #1 SMP PREEMPT Thu Jul 26
09:36:26 UTC 2012 (641c197) x86_64 x86_64 x86_64 GNU/Linux

I am trying version 2.14.1 on first machine and 2.15.1 on second machine.
On both machines I'm using gcc and gfortran, version 4.5.4.
On both machines I get the same test-error (the example below is for
2.14.1, but the messages are identicall with 2.15.1):

running code in 'reg-examples1.R' ... OK
running code in 'reg-examples2.R' ... OK
running code in 'reg-packages.R' ...make[4]: *** [reg-packages.Rout]
Error 1
make[4]: Leaving directory
`/home/csoliver/OKplatform/ExternalSources/builds/R/R-2.14.1/tests'
make[3]: *** [test-Reg] Error 2
make[3]: Leaving directory
`/home/csoliver/OKplatform/ExternalSources/builds/R/R-2.14.1/tests'
make[2]: *** [test-all-basics] Error 1

The error-log in reg-packages.Rout.fail is (again for 2.14.1, but it is
identical for 2.15.1, except of the obvious differences):

---

R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ## PR 1271  detach("package:base") crashes R.
> try(detach("package:base"))
Error in detach("package:base") : detaching "package:base" is not allowed
> 
> 
> ## invalid 'lib.loc'
> stopifnot(length(installed.packages("mgcv")) == 0)
> ## gave a low-level error message
> 
> 
> ## package.skeleton() with metadata-only code
> ## work in current (= ./tests/ directory):
> tmp <- tempfile()
> writeLines(c('setClass("foo", contains="numeric")',
+              'setMethod("show", "foo",',
+              '          function(object) cat("I am a \\"foo\\"\\n"))'),
+            tmp)
> if(file.exists("myTst")) unlink("myTst", recursive=TRUE)
> package.skeleton("myTst", code_files = tmp)# with a file name warning
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Copying code files ...
Making help files ...
Done.
Further steps are described in './myTst/Read-and-delete-me'.
Warning message:
In package.skeleton("myTst", code_files = tmp) :
  Invalid file name(s) for R code in ./myTst/R:
  'file7da22fb20b64'
 are now renamed to 'z<name>.R'
> file.copy(tmp, (tm2 <- paste(tmp,".R", sep="")))
[1] TRUE
> unlink("myTst", recursive=TRUE)
> op <- options(warn=2) # *NO* "invalid file name" warning {failed in 2.7.[01]}:
> package.skeleton("myTst", code_files = tm2, namespace=TRUE)
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Copying code files ...
Making help files ...
Done.
Further steps are described in './myTst/Read-and-delete-me'.
> options(op)
> ##_2_ only a class, no generics/methods:
> writeLines(c('setClass("DocLink",',
+              'representation(name="character",',
+              '               desc="character"))'), tmp)
> if(file.exists("myTst2")) unlink("myTst2", recursive=TRUE)
> package.skeleton("myTst2", code_files = tmp)
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Copying code files ...
Making help files ...
Done.
Further steps are described in './myTst2/Read-and-delete-me'.
Warning message:
In package.skeleton("myTst2", code_files = tmp) :
  Invalid file name(s) for R code in ./myTst2/R:
  'file7da22fb20b64'
 are now renamed to 'z<name>.R'
> ##- end_2_ # failed in R 2.11.0
> stopifnot(1 == grep("setClass",
+         readLines(list.files("myTst/R", full.names=TRUE))),
+         c("foo-class.Rd","show-methods.Rd") %in% list.files("myTst/man"))
> ## failed for several reasons in R < 2.7.0
> ##
> ## Part 2: -- build, install, load and "inspect" the package:
> dir.exists <- function(x)
+     is.character(x) && file.exists(x) && file.info(path.expand(x))$isdir
> build.pkg <- function(dir) {
+     stopifnot(dir.exists(dir))
+     patt <- paste(basename(dir), ".*tar\\.gz$", sep="_")
+     unlink(dir('.', pattern = patt))
+     Rcmd <- paste(file.path(R.home("bin"), "R"), "CMD")
+     r <- tail(system(paste(Rcmd, "build --keep-empty-dirs", dir),
+                      intern = TRUE), 3)
+     ## return name of tar file built
+     dir('.', pattern = patt)
+ }
> build.pkg("myTst")

[1] "myTst_1.0.tar.gz"
> ## clean up any previous attempt (which might have left a 00LOCK)
> unlink("myLib", recursive = TRUE)
> dir.create("myLib")
> install.packages("myTst", lib = "myLib", repos=NULL, type = "source") # with warnings
* installing *source* package 'myTst' ...
** R
** preparing package for lazy loading
** help
Warning: /home/csoliver/OKplatform/ExternalSources/builds/R/R-2.14.1/tests/myTst/man/myTst-package.Rd:34: All text must be in a section
Warning: /home/csoliver/OKplatform/ExternalSources/builds/R/R-2.14.1/tests/myTst/man/myTst-package.Rd:35: All text must be in a section
*** installing help indices
** building package indices ...
** testing if installed package can be loaded

* DONE (myTst)
> print(installed.packages(lib.loc= "myLib", priority= "NA"))## (PR#13332)
      Package LibPath Version Priority Depends   Imports LinkingTo Suggests
myTst "myTst" "myLib" "1.0"   NA       "methods" NA      NA        NA      
      Enhances OS_type License                     Built   
myTst NA       NA      "What license is it under?" "2.14.1"
> stopifnot(require("myTst",lib = "myLib"))
Loading required package: myTst
> sm <- findMethods(show, where= as.environment("package:myTst"))
> stopifnot(names(sm at names) == "foo")
> unlink("myTst_*")
> 
> ## More building & installing packages
> ## NB: tests were added here for 2.11.0.
> ## NB^2: do not do this in the R sources!
> ## and this testdir is not installed.
> pkgSrcPath <- file.path(Sys.getenv("SRCDIR"), "Pkgs")
> if(file_test("-d", pkgSrcPath)) {
+     ## could use file.copy(recursive = TRUE)
+     system(paste('cp -r', shQuote(pkgSrcPath), shQuote(tempdir())))
+     pkgPath <- file.path(tempdir(), "Pkgs")
+ #    op <- options(warn = 2)    # There should be *NO* warnings here!
+     ## pkgB tests an empty R directory
+     dir.create(file.path(pkgPath, "pkgB", "R"), recursive = TRUE,
+                showWarnings = FALSE)
+     p.lis <- c("pkgA", "pkgB", "exNSS4")
+     for(p. in p.lis) {
+         cat("building package", p., "...\n")
+         r <- build.pkg(file.path(pkgPath, p.))
+         cat("installing package", p., "using file", r, "...\n")
+         ## we could install the tar file ... (see build.pkg()'s definition)
+         install.packages(r, lib = "myLib", repos=NULL, type = "source")
+         stopifnot(require(p.,lib = "myLib", character.only=TRUE))
+         detach(pos = match(p., sub("^package:","", search())))
+     }
+     ## TODO: not just print, but check the "list":
+     res <- installed.packages(lib.loc = "myLib", priority = "NA")
+     print(res)
+ #    options(op)
+     unlink("myLib", recursive = TRUE)
+     unlink(file.path(pkgPath), recursive = TRUE)
+ }
building package pkgA ...

installing package pkgA using file pkgA_1.1.tar.gz ...
Error in untar2(tarfile, files, list, exdir) : unsupported entry type 'x'
Loading required package: pkgA
Error: require(p., lib = "myLib", character.only = TRUE) is not TRUE
In addition: Warning messages:
1: In install.packages(r, lib = "myLib", repos = NULL, type = "source") :
  installation of package 'pkgA_1.1.tar.gz' had non-zero exit status
2: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'pkgA'
Execution halted

---

Unfortunatly the above says nothing to me, and I didn't find information
on the Internet.

I hope somebody can help. In the past the build-process worked (at least
for R-version 2.14.1) with Suse 11.2 and gcc version 4.5.3.

Thanks for your attention.

Oliver



[Rd] installation of R (2.14.1 and 2.15.1) fails due to [reg-packages.Rout] Error
Oliver Kullmann