Skip to content

compile 2.4.1 for linux on power cpus

10 messages · Andrew Ferris, Peter Dalgaard, Brian Ripley +1 more

#
Hello,

I've been asked to get R (2.4.1) installed on a IBM p570 server. This is a server with power CPUs and is running SLES 10. It currently has 12GB of RAM so I'd like to make sure I have the 64 bit version of R so as to take advantage of the extra memory. Since it's a power CPU server that means I'll have to compile R from source. 

I've searched the r_users list but most of the power CPU correspondence concerns either AIX or Macs. SLES 10 uses GCC 4.1.0 by default. Could someone please help me with some guidance on the necessary parameters for configure to ensure a 64 bit version of R is compiled? 
 

Andrew Ferris
Network Support Analyst
iCAPTURE Research Centre
University of British Columbia


***CONFIDENTIALITY NOTICE***
This electronic message is intended only for the use of the addressee and may contain information that is privileged and confidential.  Any dissemination, distribution or copying of this communication by unauthorized individuals is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail and delete the original and all copies from your system.
#
Andrew Ferris wrote:
Just running the 64bit version of the OS usually suffices (at least on 
Linux variants). Easiest check on a running R is

 > .Machine$sizeof.pointer
[1] 4

which gives 8 on 64-bit builds.
#
Thank you for the reply Peter. 

I've compiled R from source using the following:

./configure --host=powerpc64-power5-linux-gnu --build=powerpc64-power5-linux-gnu '--with-blas=-framework blas-3.1.0-11'

and after I've made R I get this:
[1] 4

meanwhile uname -a prints out this:

Linux [hostname] 2.6.16.21-0.8-ppc64 #1 SMP Mon Jul 3 18:25:39 UTC 2006 ppc64 ppc64 ppc64 GNU/Linux

and in the root filesystem there's a /lib and /lib64. I suspect that R needs to have the 64 bit libraries specified so is there a way to do that?

Andrew Ferris
Network Support Analyst
iCAPTURE Research Centre
University of British Columbia
Andrew Ferris wrote:
Just running the 64bit version of the OS usually suffices (at least on 
Linux variants). Easiest check on a running R is

 > .Machine$sizeof.pointer
[1] 4

which gives 8 on 64-bit builds.





***CONFIDENTIALITY NOTICE***
This electronic message is intended only for the use of the addressee and may contain information that is privileged and confidential.  Any dissemination, distribution or copying of this communication by unauthorized individuals is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail and delete the original and all copies from your system.
#
Andrew Ferris wrote:
So I was wrong in assuming that 64 bit SLES would be set up for 64 bit 
compiles.....
First check the toolchain:

which gcc
gcc -dumpmachine

You might need to revise your path and/or install 64 bit versions of the 
compilers.

Actually, looking at the package list for SLES 10, I see that some 
packages have a -64bit variant, e.g.

glibc-64bit 2.4 
<http://www.novell.com/products/linuxpackages/server10/ppc/glibc-64bit.html> 
(Standard Shared Libraries (from the GNU C Library))
glibc-devel-64bit 2.4 
<http://www.novell.com/products/linuxpackages/server10/ppc/glibc-devel-64bit.html> 
(Include Files and Libraries Mandatory for Development)

but the gcc package does not, and the gcc-fortran-64bit 4.1.0 
<http://www.novell.com/products/linuxpackages/server10/ppc/gcc-fortran-64bit.html> 
packages contains only libraries. So my guess is that there is one 
compiler that does both 32 bit and 64 bit compiling, but you need to set 
a compiler flag for the latter.

I don't think messing with --build and --host is likely to do any good.
#
Peter,

First off, as you may have guessed, I don't compile many 64 bit programs so thanks again for the help. I'll revert back to powerpc64-unknown-linux-gnu which is the default for -build and -host.

Here's the gcc information
[hostname]:/ # which gcc
/usr/bin/gcc
[hostname]:/ # gcc -dumpmachine
powerpc64-suse-linux
-m64
    
Generate code for 32-bit or 64-bit environments of Darwin and SVR4 targets (including GNU/Linux). The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any PowerPC variant. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits, and generates code for PowerPC64, as for -mpowerpc64. 

So would some compiler flags such as these work:

'CC=gcc -m64' 'CXX=g++ -m64' 'FC=gfortran -mc64' 'F77=gfortran -m64' 'LDFLAGS=-L/lib64'



Andrew Ferris
Network Support Analyst
iCAPTURE Research Centre
University of British Columbia
Andrew Ferris wrote:
So I was wrong in assuming that 64 bit SLES would be set up for 64 bit 
compiles.....
First check the toolchain:

which gcc
gcc -dumpmachine

You might need to revise your path and/or install 64 bit versions of the 
compilers.

Actually, looking at the package list for SLES 10, I see that some 
packages have a -64bit variant, e.g.

glibc-64bit 2.4 
<http://www.novell.com/products/linuxpackages/server10/ppc/glibc-64bit.html> 
(Standard Shared Libraries (from the GNU C Library))
glibc-devel-64bit 2.4 
<http://www.novell.com/products/linuxpackages/server10/ppc/glibc-devel-64bit.html> 
(Include Files and Libraries Mandatory for Development)

but the gcc package does not, and the gcc-fortran-64bit 4.1.0 
<http://www.novell.com/products/linuxpackages/server10/ppc/gcc-fortran-64bit.html> 
packages contains only libraries. So my guess is that there is one 
compiler that does both 32 bit and 64 bit compiling, but you need to set 
a compiler flag for the latter.

I don't think messing with --build and --host is likely to do any good.



***CONFIDENTIALITY NOTICE***
This electronic message is intended only for the use of the addressee and may contain information that is privileged and confidential.  Any dissemination, distribution or copying of this communication by unauthorized individuals is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail and delete the original and all copies from your system.
#
Andrew Ferris wrote:
That's likely. Or use CFLAGS=-m64, and FFLAGS, CXXFLAGS similarly.

I'd try compiling a simple hello.c program first. Try e.g. "gcc -m64 
hello.c" and see what "file a.out" has to say about the result.

You may also find yourself having to install a number of packages  with 
names like foo-64bit_xx.yy to get 64bit C libraries, but configure 
should tell you about any missing bits in due course, once you have it 
convinced not to build for 32bit.
#
On Thu, 15 Mar 2007, Peter Dalgaard wrote:

            
The CC etc forms are preferred, as not all configure scripts use the 
environment CFLAGS.

See the Solaris 64-bit notes in the R-admin manual for proven examples.

  
    
#
I'm closer but still not quite there. Here's the configure command I'm using:

 ./configure 'CC=gcc -m64' 'CXX=g++ -m64 -mminimal-toc' 'FC=gfortran -mc64 -fno-optimize-sibling-calls' 'F77=gfortran -m64 -fno-optimize-sibling-calls' 'LDFLAGS=-L/usr/lib64' R_PAPERSIZE='letter'

I'm using the -mminimal-toc and -fno-optimize-sibling-calls flags because of this error during make:

/usr/bin/ld: ../nmath/libnmath.a(gamma.o)(.text+0xf4): sibling call optimization to `Rf_chebyshev_eval' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `Rf_chebyshev_eval' extern
/usr/bin/ld: ../nmath/libnmath.a(gamma.o)(.text+0x270): sibling call optimization to `Rf_stirlerr' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `Rf_stirlerr' extern
/usr/bin/ld: ../nmath/libnmath.a(gamma.o)(.text+0x34c): sibling call optimization to `Rf_lgammacor' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `Rf_lgammacor' extern
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory `/usr/local/R-2.4.1/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/usr/local/R-2.4.1/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/usr/local/R-2.4.1/src'
make: *** [R] Error 1

But those flags aren't helping as those errors persist. Is there anything else I can do?

thanks,


Andrew Ferris
Network Support Analyst
iCAPTURE Research Centre
University of British Columbia
On Thu, 15 Mar 2007, Peter Dalgaard wrote:

            
The CC etc forms are preferred, as not all configure scripts use the 
environment CFLAGS.

See the Solaris 64-bit notes in the R-admin manual for proven examples.

  
    
#
2007/3/16, Andrew Ferris <aferris at mrl.ubc.ca>:
$ uname -a
Linux macg5 2.6.18-3-powerpc64 #1 SMP Mon Dec 4 15:40:16 CET 2006
ppc64 GNU/Linux

$ gcc -v
Using built-in specs.
Target: powerpc-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --disable-softfloat
--enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32
--enable-checking=release powerpc-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

$ gcc -print-multi-lib
.;@fPIC at mstrict-align
64;@m64 at fPIC@mstrict-align

$ ./configure CC="gcc -m64" \
                   CXX="gxx -m64" \
                   F77="gfortran -m64" \
                   FC="gfortran -m64" \
                   CFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" \
                   FFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" \
                   --without-x

$ file bin/exec/R
bin/exec/R: ELF 64-bit MSB executable, PowerPC 64-bit or cisco 7500,
version 1 (SYSV), for GNU/Linux 2.6.0, dynamically linked (uses shared
libs), for GNU/Linux 2.6.0, not stripped
#
Thank you Ei-ji, 

That seems to have done it.
[1] 8

So in total I've done the following to get it work:

Installed these readline rpms from the SLES10 media:

readline-devel-64bit-5.1-24.4
readline-devel-5.1-24.4

This is the configure command:

./configure CC="gcc -m64" /
CXX="gxx -m64" /
F77="gfortran -m64" / 
FC="gfortran -m64" /
CFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" /
FFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" /
LDFLAGS=-L/usr/lib64 /
--without-x

which gets this:

R is now configured for powerpc64-unknown-linux-gnu

  Source directory:          .
  Installation directory:    /usr/local

  C compiler:                gcc -m64 -std=gnu99  -mminimal-toc -fno-optimize-sibling-calls -g -O2
  Fortran 77 compiler:       gfortran -m64  -mminimal-toc -fno-optimize-sibling-calls -g -O2

  C++ compiler:              gxx -m64
  Fortran 90/95 compiler:    gfortran -m64 -g -O2

  Interfaces supported:
  External libraries:        readline
  Additional capabilities:   iconv, MBCS, NLS
  Options enabled:           shared BLAS, R profiling

  Recommended packages:      yes

configure: WARNING: I could not determine CXXPICFLAGS.
configure: WARNING: I could not determine SHLIB_CXXLDFLAGS
configure: WARNING: I could not determine CXXPICFLAGS.
configure: WARNING: you cannot build DVI versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: I could not determine a PDF viewer

And that gets through make with no errors. That's R 2.4.1 on SLES10 on a power5 CPU server. 

Thank-you to Peter Dalgaard and Prof. Ripley for their help with this.

Andrew Ferris
Network Support Analyst
iCAPTURE Research Centre
University of British Columbia
2007/3/16, Andrew Ferris <aferris at mrl.ubc.ca>:
$ uname -a
Linux macg5 2.6.18-3-powerpc64 #1 SMP Mon Dec 4 15:40:16 CET 2006
ppc64 GNU/Linux

$ gcc -v
Using built-in specs.
Target: powerpc-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --disable-softfloat
--enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32
--enable-checking=release powerpc-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

$ gcc -print-multi-lib
.;@fPIC at mstrict-align
64;@m64 at fPIC@mstrict-align

$ ./configure CC="gcc -m64" \
                   CXX="gxx -m64" \
                   F77="gfortran -m64" \
                   FC="gfortran -m64" \
                   CFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" \
                   FFLAGS="-mminimal-toc -fno-optimize-sibling-calls -g -O2" \
                   --without-x

$ file bin/exec/R
bin/exec/R: ELF 64-bit MSB executable, PowerPC 64-bit or cisco 7500,
version 1 (SYSV), for GNU/Linux 2.6.0, dynamically linked (uses shared
libs), for GNU/Linux 2.6.0, not stripped