From harald at cepba.upc.es  Thu May  8 12:31:27 2003
From: harald at cepba.upc.es (Harald Servat Gelabert)
Date: Thu May  8 11:31:30 2003
Subject: [Rd] problems compiling R on AIX5.1
Message-ID: <3EBA23EF.B93D0430@cepba.upc.es>

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

...


* 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!,

-- 
________________________________________________________________________
             Harald Servat Gelabert (harald@cepba.upc.es)
   o//o      Centre Europeu de Paral.lelisme de Barcelona          CEPBA
  o//o       WWW...: http://www.cepba.upc.es       Tel: +34-93-401 74 23
 o//o        e-mail: suport@cepba.upc.es           Fax: +34-93-401 25 77
o//o  CEPBA  c/Jordi Girona, 1-3, M?dul D6. E-08034 Barcelona, Catalunya
________________________________________________________________________

The optimist thinks that this is the best of all possible worlds,
and the pessimist knows it.
-- J. Robert Oppenheimer, "Bulletin of Atomic Scientists"

We scientists, whose tragic destiny it has been to make the methods
of annihilation ever more gruesome and more effective, must consider
it our solemn and transcendent duty to do all in our power in
preventing these weapons from being used for the brutal purpose for
which they were invented.
-- Albert Einstein,       "Bulletin of Atomic Scientists"


[Rd] problems compiling R on AIX5.1
Harald Servat Gelabert