From ripley at stats.ox.ac.uk  Thu May  8 19:25:19 2003
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu May  8 19:25:32 2003
Subject: [Rd] problems compiling R on AIX5.1
In-Reply-To: <3EBA23EF.B93D0430@cepba.upc.es>
Message-ID: <Pine.LNX.4.44.0305081822240.22523-100000@gannet.stats>

Thank you for the success report!

AFAIK macros FC and CCFLAGS are not used, and it is CXX and not CCC for 
the C++ compiler.

We will alter foreign's names to avoid the conflicts.


On Thu, 8 May 2003, Harald Servat Gelabert wrote:

> Dear all,
> 
> after trying to compile R on our IBM Power3/AIX 5.1 machine I've
> been able to run it correctly.
> 
> First of all I would thank all who responded my mails.
> 
> I explain here how I've done it:
> 
> First of all, it seems that configure and some shared libraries of
> AIX does not work at the same time. I tried to configure & make with
> the following environment vars
> 
> CC=xlc
> F77=xlf
> CCC=xlC
> CFLAGS=-O3 -qstrict -qmaxmem=8192
> FFLAGS=-O3 -qstrict -qmaxmem=8192
> MAIN_LDFLAGS=-Wl,-brtl
> SHLIB_LDFLAGS=-Wl,-G
> CXXFLAGS=-O2 -qmaxmem=8192
> FC=xlf
> CCFLAGS=-O3 -qstrict -qmaxmem=8192
> 
> But for some reason at make the compilation failed when trying to
> locate a shared library for X. For this reason I tried to discard
> shared libraries enabling --disable-shared on configure, but this 
> didn't help (Nor removing MAIN_LDFLAGS and SHLIB_LDFLAGS). Next I
> tried to compile without X environment and I got the following error

--disable-shared is the default: it refers to *building* shared libraries 
(libR.so in R's case).

> ...
> 
> 
> * Installing *source* package 'foreign' ...
> creating cache ./config.cache
> checking for gcc... xlc
> checking whether the C compiler (xlc -O2 -qmaxmem=8192 ) works... yes
> checking whether the C compiler (xlc -O2 -qmaxmem=8192 ) is a cross-compiler...
> yes
> checking whether we are using GNU C... no
> checking whether xlc accepts -g... yes
> checking how to run the C preprocessor... xlc -E
> checking for byteswap.h... no
> checking size of double... 8
> checking size of int... 4
> checking size of long... 4
> updating cache ./config.cache
> creating ./config.status
> creating src/var.h
> creating src/swap_bytes.h
> ** libs
>         xlc -I/scratch_tmp/harald/R-1.6.1/include  -I/usr/local/include     -O2
> -qmaxmem=8192 -c SASxport.c -o SASxport.o
> "foreign.h", line 51.13: 1506-334 (S) Identifier int32 has already been defined
> on line 633 of "/usr/include/sys/inttypes.h".
> "foreign.h", line 52.15: 1506-334 (S) Identifier int16 has already been defined
> on line 632 of "/usr/include/sys/inttypes.h".
> make: 1254-004 The error code from the last command is 1.
> 
> Stop.
> ERROR: compilation failed for package 'foreign'
> make: 1254-004 The error code from the last command is 5.
> 
> ...
> 
> At this point I was looking for foreign.h, but it was in a TAR.GZ! 
> I place comment on lines 51 and 52 for taking int16/int32 out
> (as AIX headers does define them and XLC fails compiling -- 
>  while GCC continues showing only a warning!)
> When those lines were commented I make a new TAR.GZ and update the
> softlink to the modified version.
> 
> 
> With this modifications the main program where created. Was time
> for 'make check'... and failed! There was a problem on ESSL and
> R, so I forced R not to use the default BLAS (ESSL) of the machine
> (--without-blas).
> 
> After removing all temporal files, reconfiguring and recompiling
> the make check WORK PROPERLY! :D
> 
> In brief, the environment I used to compile was
> 
> CC=xlc
> F77=xlf
> CCC=xlC
> CFLAGS=-O3 -qstrict -qmaxmem=8192
> FFLAGS=-O3 -qstrict -qmaxmem=8192
> MAIN_LDFLAGS=-Wl,-brtl
> SHLIB_LDFLAGS=-Wl,-G
> CXXFLAGS=-O2 -qmaxmem=8192
> FC=xlf
> CCFLAGS=-O3 -qstrict -qmaxmem=8192
> 
> ./configure --prefix=YOURDIRECTORY --without-x --without-blas
> 
> As our machine and our user plans to use R only for a compute
> intesive calculations there's no need to use X. So this 
> compilation is perfect for our purposes.
> 
> Many thanks to all!,
> 
> 

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] problems compiling R on AIX5.1
Prof Brian Ripley