Skip to content

Problem building R-2.15.3 from source

4 messages · Mark Dalphin, Pascal Oettli, Brian Ripley

#
Hi,

I have for many years build R from source for Linux. I have just run 
into my first problem with this in ... I don't know how long.

uname -a
Linux douglas 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux

cat /etc/issue
Debian GNU/Linux 7 \n \l


The version of R is 2.15.3. I know it is old, but we are in a regulated 
environment and changes to R versions are painful. I have built R 2.15.3 
elsewhere and have it running on multiple Linux boxes around here, both 
32-bit and 64-bit; Ubuntu distributions, however, not Debian.

This build is on a virtual machine under OpenBox. The host is a 64-bit 
Debian; the guest is a 32-bit Debian installation.

The symptoms are strange (to me). I get segfaults during the 
byte-compiling phase of libraries. If I re-run 'make', the make proceeds 
as if it finished the previous seg-faulted step, and then segfaults on 
the next byte-compile. The "permissions" makes me wonder about file 
permissions, but the whole 'make' is under my HOME. Furthermore, I have 
scanned the unpacked tar-gz package for something I don't "own" and it 
isn't there. I also think segfaults are usually in memory, though I 
don't know what "permission" I have there (don't I own the RAM I request?).

I have attached a section of the 'make' output  below, followed by a the 
next "make" output:
----------------------------------------------------------------------------------------------------------
make[4]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/splines'
make[4]: Entering directory 
`/home/mdalphin/src/R-2.15.3/src/library/splines'
byte-compiling package 'splines'

 *** caught segfault ***
address 0x403ac3dc, cause 'invalid permissions'

Traceback:
 1: fun(libname, pkgname)
 2: doTryCatch(return(expr), name, parentenv, handler)
 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 4: tryCatchList(expr, classes, parentenv, handlers)
 5: tryCatch(fun(libname, pkgname), error = identity)
 6: runHook(".onLoad", env, package.lib, package)
 7: loadNamespace(name)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(loadNamespace(name), error = function(e) stop(e))
12: getNamespace(ns)
13: asNamespace(pkg)
14: get(name, envir = asNamespace(pkg), inherits = FALSE)
15: compiler:::tryCmpfun
16: .Call("R_lazyLoadDBinsertValue", x[[1L]], file, ascii, compress,     
hook, PACKAGE = "base")
17: lazyLoadDBinsertVariable(vars[i], from, datafile, ascii, 
compress,     envhook)
18: makeLazyLoadDB(ns, dbbase, compress = compress)
19: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = 
keep.source,     compress = compress)
20: tools:::makeLazyLoading("splines")
aborting ...
/bin/bash: line 8: 18709 Done                    echo 
"tools:::makeLazyLoading(\"splines\")"
     18710 Segmentation fault      | R_COMPILE_PKGS=1 
R_COMPILER_SUPPRESS_ALL=1 R_DEFAULT_PACKAGES=NULL LC_ALL=C 
../../../bin/R --vanilla --slave > /dev/null
make[4]: *** [../../../library/splines/R/splines.rdb] Error 139
make[4]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/splines'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/splines'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/mdalphin/src/R-2.15.3/src'
make: *** [R] Error 1
-------------------------------------------------------------------------------------------
make[4]: Entering directory 
`/home/mdalphin/src/R-2.15.3/src/library/splines'
make[4]: Nothing to be done for `mklazycomp'.
make[4]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/splines'
make[3]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/splines'
make[3]: Entering directory `/home/mdalphin/src/R-2.15.3/src/library/stats4'
building package 'stats4'
mkdir -p -- ../../../library/stats4
make[4]: Entering directory `/home/mdalphin/src/R-2.15.3/src/library/stats4'
mkdir -p -- ../../../library/stats4/R
mkdir -p -- ../../../library/stats4/po
make[4]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/stats4'
make[4]: Entering directory `/home/mdalphin/src/R-2.15.3/src/library/stats4'
byte-compiling package 'stats4'

 *** caught segfault ***
address 0x403ac3dc, cause 'invalid permissions'

Traceback:
 1: fun(libname, pkgname)
 2: doTryCatch(return(expr), name, parentenv, handler)
 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 4: tryCatchList(expr, classes, parentenv, handlers)
 5: tryCatch(fun(libname, pkgname), error = identity)
 6: runHook(".onLoad", env, package.lib, package)
 7: loadNamespace(name)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(loadNamespace(name), error = function(e) stop(e))
12: getNamespace(ns)
13: asNamespace(pkg)
14: get(name, envir = asNamespace(pkg), inherits = FALSE)
15: compiler:::tryCmpfun
16: .Call("R_lazyLoadDBinsertValue", x[[1L]], file, ascii, compress,     
hook, PACKAGE = "base")
17: lazyLoadDBinsertVariable(vars[i], from, datafile, ascii, 
compress,     envhook)
18: makeLazyLoadDB(ns, dbbase, compress = compress)
19: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = 
keep.source,     compress = compress)
20: tools:::makeLazyLoading("stats4")
aborting ...
/bin/bash: line 8: 19554 Done                    echo 
"tools:::makeLazyLoading(\"stats4\")"
     19555 Segmentation fault      | R_COMPILE_PKGS=1 
R_COMPILER_SUPPRESS_ALL=1 R_DEFAULT_PACKAGES="methods,graphics,stats" 
LC_ALL=C ../../../bin/R --vanilla --slave > /dev/null
make[4]: *** [../../../library/stats4/R/stats4.rdb] Error 139
make[4]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/stats4'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library/stats4'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/mdalphin/src/R-2.15.3/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/mdalphin/src/R-2.15.3/src'
make: *** [R] Error 1
#
I have found a solution to the repeated seg-faults below.

If I set environment variables:
    setenv CFLAGS -O2
    setenv FFLAGS -O2
rather than the default -O3, then R builds and "checks" successfully.

A few more details about the Debian system on which I have been building:
     gcc (Debian 4.7.2-5) 4.7.2

My "configure" command is:
./configure                 \
    --prefix=$my_R_path \
    --with-readline     \
    --without-x         \
    --enable-R-shlib    \
    --enable-BLAS-shlib \
    --with-system-zlib  \
    --with-system-bzlib \
     --with-system-pcre

So, I'm good for the time being and hope this helps others who have 
trouble building from source.

Cheers,
Mark
Mark Dalphin wrote:

  
    
#
On 11/07/2013 06:44, Pascal Oettli wrote:
And since this is a ix86 system, you really should be using -mtune=native.

I do not believe the default in 2.15.3 was -O3: it is not in current R, 
and it certainly included -g .
Others who do not follow the instructions?  As the manual says at the end

'Beware of using high levels of optimization, at least initially. On 
many compilers these reduce the degree of compliance to the IEEE model.'