[R-SIG-Mac] R-1.8.0 + IBM VisualAge/C for AIX compiler

Simon Urbanek Simon.Urbanek at math.uni-augsburg.de
Fri Oct 31 13:33:09 MET 2003


A while ago I compiled R 1.7.0 for AIX (with the above compiler - I'll  
call it xlc) and I was surprised that it went quite smoothly.

Unfortunately with R 1.8.0 it's not as easy, but I succeeded at least  
partially. Static R works fine (after some tweaking), but  
--enable-R-shlib fails resp. produces a buggy R. Following are the  
problems I encountered (in a warning-to-fatal-error sequence):

0)
  configure says:
configure: WARNING: I could not determine SHLIB_CXXLDFLAGS
I don't know if this is important, I assume it's not since there should  
be no C++ code ;)

1) .lo files
As Jan already stated in his r-sig-mac post:

>> then pass them to ld, but more importantly they refuse to handle any
>> file with name foo.lo. Is the "lo" a configure switch I can set to "o"
>
> I think the configure code actually tests whether the compilers can
> handle -c -o .lo, and have a workaround if this fails.

The configure code looks whether the compile can *create* .lo (xlc can  
do so), but xlc issues tons of warnings when it's told to *link* .lo  
files:

[...]
cc: 1501-218 file ../unix/sys-common.lo contains an incorrect file  
suffix
cc: 1501-218 file ../unix/sys-std.lo contains an incorrect file suffix
cc: 1501-218 file ../unix/sys-unix.lo contains an incorrect file suffix
cc: 1501-218 file ../unix/system.lo contains an incorrect file suffix

I don't know if this has an impact on the linking, but I hope it  
doesn't since fixing this one is really a pain. It is possible that  
more recent xlcs turned this warning into an error...

2) this is not AIX related, but nevertheless annoying:
make[3]: Entering directory `/tmp/R-1.8.0.build/src/library/base'
building package 'base'
/bin/sh: /usr/bin/cat: 0403-027 The parameter list is too long.

If unfixed, I get errors like:
Error: couldn't find function "attach"
(fix: put the source directory somewhere down the tree - e.g. I  
symlinked it to /tmp/R ;)).

3) tilde_expand from readline:
"/.../dce.uni-augsburg.de/fs/home/mathe/sta/urbanesi/work/R-1.8.0/src/ 
unix/sys-unix.c", line 103.14: 1506-196 (S) Initialization between  
types "char*" and "int" is not allowed.
fix: add a corresponding declaration for tilde_expand

4) .so vs .a
ld: 0706-006 Cannot find or open library file: -l Rlapack
         ld:open(): A file or directory in the path name does not exist.
problem: xlc looks for .a suffix even for shared libraries, butR uses  
.so - a fix is to symlink libRlapack.so to libRlapack.a (any AIX-savvy  
folks here that could tell me how to change that behavior in xlc?)

Ok, now such static R works fine.

But when --enable-R-shlib is on then I get:

5) while making libR.so - bad path to R.exp
ld: 0706-003 Cannot find or read import file: /etc/R.exp
         ld:accessx(): A file or directory in the path name does not  
exist.
make[3]: *** [libR.so] Error 255

for some reason /etc/R.exp ends up in the flags instead of  
$(top_builddir)/etc/R.exp . My guess is that there is also  
$(R_HOME)/etc/R.exp in Makeconf and $R_HOME is not set when compiling  
the R shared library.
Setting R_HOME to the build directory indeed fixes this.

6) when linking to libR.a: many duplicate symbols
Every time a module links against libR duplicate symbols are claimed.  
For example when compiling R_X11.so:

         xlc -Wl,-bM:SRE -Wl,-H512 -Wl,-T512 -Wl,-bnoentry -Wl,-bexpall  
-Wl,-bI:../../../etc/R.exp -L/usr/local/lib -o R_X11.so  dataentry.lo  
devX11.lo rotated.lo rbitmap.lo -lSM -lICE -lX11   -L../../../bin -lR  
-lbz2 -lreadline -ldl -lncurses -lm -lc
xlc: 1501-218 file dataentry.lo contains an incorrect file suffix
xlc: 1501-218 file devX11.lo contains an incorrect file suffix
xlc: 1501-218 file rotated.lo contains an incorrect file suffix
xlc: 1501-218 file rbitmap.lo contains an incorrect file suffix
ld: 0711-224 WARNING: Duplicate symbol: p_xargc
ld: 0711-224 WARNING: Duplicate symbol: p_xargv
ld: 0711-224 WARNING: Duplicate symbol: p_xrcfg
ld: 0711-224 WARNING: Duplicate symbol: p_xrc
ld: 0711-224 WARNING: Duplicate symbol: end
ld: 0711-224 WARNING: Duplicate symbol: .Rf_error
ld: 0711-224 WARNING: Duplicate symbol: Rf_error
ld: 0711-224 WARNING: Duplicate symbol: .Rf_warning
ld: 0711-224 WARNING: Duplicate symbol: Rf_warning
ld: 0711-224 WARNING: Duplicate symbol: .Rf_lengthgets
ld: 0711-224 WARNING: Duplicate symbol: Rf_lengthgets
ld: 0711-224 WARNING: Duplicate symbol: .R_Reprotect
ld: 0711-224 WARNING: Duplicate symbol: R_Reprotect
ld: 0711-224 WARNING: Duplicate symbol: .Rf_mkChar
ld: 0711-224 WARNING: Duplicate symbol: Rf_mkChar
ld: 0711-224 WARNING: Duplicate symbol: .SET_STRING_ELT
ld: 0711-224 WARNING: Duplicate symbol: SET_STRING_ELT
ld: 0711-224 WARNING: Duplicate symbol: .Rf_isNull
ld: 0711-224 WARNING: Duplicate symbol: Rf_isNull
[...]
ld: 0711-224 WARNING: Duplicate symbol: .Rprintf
ld: 0711-224 WARNING: Duplicate symbol: Rprintf
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more  
information.

with -bnoquiet I get:

  p_xargc                   crt0main.s(/lib/crt0.o)
     ** Duplicate **        {../../../bin/libR.a}
[...]
.Rf_error                 {../../../bin/libR.a}
     ** Duplicate **        ../../../etc/R.exp{.}
  Rf_error                  {../../../bin/libR.a}
     ** Duplicate **        ../../../etc/R.exp{.}
[...]

7) now, when such R is run, things go wrong. Just after starting R this  
appears:

Error in open.connection(con, "rb") : unable to open connection
In addition: Warning message:
cannot open compressed file  
`/.../dce.uni-augsburg.de/fs/home/mathe/sta/urbanesi/work/R- 
1.8.0.build/library/methods/R/all.rda'

doing anything produces more warnings:

 > 1:10/2
  [1] 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Warning message:
package methods in options("defaultPackages") was not found

back to 6) - Removing -Wl:-bI...R.exp from the linking removes all  
R-related warnings, but then something strange happens:

building package 'methods'
mkdir -p -- ../../../library/methods/R
all.R is unchanged
mkdir -p -- ../../../library/methods/man
Target "Makedeps" is up to date.
mkdir -p -- ../../../../library/methods/libs
dumping R code in package 'methods'
Saving namespace image ...
/bin/sh: 26442 Segmentation fault(coredump)
make: 1254-004 The error code from the last command is 139.

Any idea how to debug this or what goes on with the R.exp??

Simon

----

R 1.8.0 (release tar-ball)
System: AIX 4.3.3.0
compiler: VisualAge C++/C for AIX Version 5.0.2.0, XL Fortran for AIX  
7.1.0.0

call to configure:
CC=xlc CXX=xlc  
/.../dce.uni-augsburg.de/fs/home/mathe/sta/urbanesi/work/R-1.8.0/ 
configure --prefix=${HOME}/aix --enable-R-shlib

configure output:
R is now configured for powerpc-ibm-aix4.3.3.0

   Source directory:           
/.../dce.uni-augsburg.de/fs/home/mathe/sta/urbanesi/work/R-1.8.0
   Installation directory:     
/.../dce.uni-augsburg.de/fs/home/mathe/sta/urbanesi/aix

   C compiler:                xlc  -g
   C++ compiler:              xlc  -g
   Fortran compiler:          f77  -g

   Interfaces supported:      X11
   External libraries:        readline, BLAS(ESSL)
   Additional capabilities:   bzip2, PCRE
   Options enabled:           shared library, R profiling

   Recommended packages:      yes

configure: WARNING: I could not determine SHLIB_CXXLDFLAGS

---
Simon Urbanek
Department of computer oriented statistics and data analysis
University of Augsburg
Universitätsstr. 14
86135 Augsburg
Germany

Tel: +49-821-598-2236
Fax: +49-821-598-2200

Simon.Urbanek at Math.Uni-Augsburg.de
http://simon.urbanek.info



More information about the R-SIG-Mac mailing list