Skip to content

Unable to compile R 3.1.3 under GCC 4.1.2 (Red Hat 4.1.2-51)

5 messages · Titus Barik, Dirk Eddelbuettel, Gábor Csárdi +1 more

#
Hi all,

I'm unable to compile R under an HPC system (which like many HPC systems
doesn't always have the latest and greatest software). The version of
GCC is 4.1.2 under CentOS 5.7. Running ./configure gives the following
output:

R is now configured for x86_64-unknown-linux-gnu
 
  Source directory:          .
  Installation directory:    /home/tbarik
 
  C compiler:                gcc -std=gnu99  -I/home/tbarik/include
  Fortran 77 compiler:       gfortran  -g -O2
 
  C++ compiler:              g++  -g -O2
  C++ 11 compiler:
  Fortran 90/95 compiler:    gfortran -g -O2
  Obj-C compiler:
 
  Interfaces supported:      X11
  External libraries:        readline
  Additional capabilities:   NLS
  Options enabled:           shared BLAS, R profiling
 
  Recommended packages:      yes

which I think looks good (at least, -std=gnu99 appears to be present).
However, when I try make, I receive the following dump during
installation of the Matrix package:

* installing *source* package 'Matrix' ...
** package 'Matrix' successfully unpacked and MD5 sums checked
** libs
make[3]: Entering directory
`/state/partition1/tmp/RtmpCw7v7G/R.INSTALL3227fa892a3/Matrix/src'
mpicc -I/home/tbarik/src/R-3.1.1/include -DNDEBUG -DNTIMER
-I./SuiteSparse_config -I/usr/local/incl        ude    -fpic 
-I/home/tbarik/include  -c CHMfactor.c -o CHMfactor.o
In file included from CHMfactor.h:4,
                 from CHMfactor.c:2:
Mutils.h: In function 'inv_permutation':
Mutils.h:270: error: 'for' loop initial declaration used outside C99
mode
In file included from Mutils.h:374,
                 from CHMfactor.h:4,
                 from CHMfactor.c:2:
t_sparseVector.c: In function 'dsparseVector_sub':
t_sparseVector.c:139: error: 'for' loop initial declaration used outside
C99 mode
In file included from Mutils.h:377,
                 from CHMfactor.h:4,
                 from CHMfactor.c:2:
t_sparseVector.c: In function 'isparseVector_sub':
t_sparseVector.c:139: error: 'for' loop initial declaration used outside
C99 mode
In file included from Mutils.h:380,
                 from CHMfactor.h:4,
                 from CHMfactor.c:2:
t_sparseVector.c: In function 'lsparseVector_sub':
t_sparseVector.c:139: error: 'for' loop initial declaration used outside
C99 mode
In file included from Mutils.h:383,
                 from CHMfactor.h:4,
                 from CHMfactor.c:2:
t_sparseVector.c: In function 'nsparseVector_sub':
t_sparseVector.c:139: error: 'for' loop initial declaration used outside
C99 mode
In file included from Mutils.h:386,
                 from CHMfactor.h:4,
                 from CHMfactor.c:2:
t_sparseVector.c: In function 'zsparseVector_sub':
t_sparseVector.c:139: error: 'for' loop initial declaration used outside
C99 mode
make[3]: *** [CHMfactor.o] Error 1
make[3]: Leaving directory
`/state/partition1/tmp/RtmpCw7v7G/R.INSTALL3227fa892a3/Matrix/src'
ERROR: compilation failed for package 'Matrix'
* removing '/home/tbarik/src/R-3.1.1/library/Matrix'
make[2]: *** [Matrix.ts] Error 1

Any advice on what to do is greatly appreciated.

Thanks,

Titus
#
On 1 September 2014 at 12:58, Titus Barik wrote:
| I'm unable to compile R under an HPC system (which like many HPC systems
| doesn't always have the latest and greatest software). The version of
| GCC is 4.1.2 under CentOS 5.7.

With all due respect, that gcc release is from Feb 2007 [1].  

You are presumably not trying to stick to the corresponding R release --
which would be R 2.4.1 or R 2.5.0 as of Apr 2007.  So consider an upgrade of
other pieces of the system too, if you can.  

It is not entirely fair to expect current releases of software to work with a
toolchains from 7 1/2 years ago.

In the future, containerization will make that easier, but you are probably
also running a 2.4 kernel so ...   

All that said, I feel your pain.  But if you manage to download and configure
from a tarball for R, consider doing the same for gcc/g77/g++ and friends.

Dirk

[1] https://ftp.gnu.org/gnu/gcc/gcc-4.1.2/
#
Hi, see this about updating your gcc. Assuming you can do that:
https://www.centos.org/forums/viewtopic.php?t=22240

Gabor
On Mon, Sep 1, 2014 at 3:58 PM, Titus Barik <titus at barik.net> wrote:
#
It seems you are using mpicc as your compiler for the Matrix package, 
and have not selected C99 mode for it.  I don't know how you did that: 
maybe you have CC set in your environment.  To get to that point you 
will have compiled lots of R which uses C99 features.

There is no such thing as R 3.1.3 (in the subject), but this seems to be 
R 3.1.1.
On 01/09/2014 20:58, Titus Barik wrote:

  
    
#
Hi,

Thanks for the replies. The version is indeed 3.1.1 (sorry about the
typo in the subject line). I was able to make progress and get R to
compile after setting --with-recommended-packages=no, since the Matrix
package was the only blocker.

I went back as far as R 2.15.3, which had the same issue.

Noticing mpicc was a good insight. I'm curious myself how it is that
mpicc is being selected. It only happens for the Matrix package; looking
through the compilation everything else is correctly using gcc -std=c99
as the output of configure suggests.

Probably what I will do is compile those recommended packages separately
as needed and ensure that they get the correct flags to ./configure when
doing so.

Thanks,

Titus