[Rd] Compiling R (1.3.0) on AIX (4.3) fails (PR#1034)

Thomas J Vogels vogels@cmu.edu
Wed, 1 Aug 2001 23:30:33 -0400

Excerpt from email by Kurt Hornik:

>>> On second thought: the comment in tkConfig.sh says
>>> # String to pass to linker to pick up the Tk library from its
>>> # installed directory.
>>> so maybe this assumes to be called by ld directly ...

I think you're right with this assumption, but sadly, the current devel
release for tcl/tk 8.4a2 is broken--even the maintainers of tcl/tk don't
know how they want to handle TK_LIB_SPEC, TK_LIBS and friends!  When I tried
to compile Tk it failed for 'wish'.  I'll check out how to file bug reports
against tcl/tk...

>>> What happens if we omit TK_LIB_SPEC from TCLTK_LIBS?
>> hell breaks loose.  TK_LIB_SPEC contains '-bI/some/path/libtk8.3.exp'
>> which is needed badly when linking on AIX.
> Argh.  After sinking some more time into this ... here's what happens.
> Assuming that both tclConfig.sh and tkConfig.sh are found, we do
> Using tcl8.4a1 and tk8.4a1 one gets for a shared build on AIX from the
> TclTk configure code:
>     if test "$using_gcc" = "yes" ; then
>         TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
>         TCL_LIB_SPEC="-Wl,-bI:${exec_prefix}/lib/${TCL_EXP_FILE} -L`pwd`"

... which is wrong, BTW:  TCL_LIB_SPEC should refer to ${exec_prefix}/lib
not `pwd` ...

>     else
>         TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
>         TCL_LIB_SPEC="-bI:${exec_prefix}/lib/${TCL_EXP_FILE}"
>     fi
>    TK_LIB_SPEC="-bI:${exec_prefix}/lib/${TK_EXP_FILE}"
> So the TclTk maintainers in their infinite wisdom have caught the gcc
> case for tcl but not for tk.

That would explain why Tcl/Tk compiles with Aix's cc but not gcc.

> I therefore suggest the following.
> * Can you try replacing
>   in m4/R.m4 by
>   and see if that works?  (You will have to configure using
>   --enable-maintainer-mode to get configure rebuilt.  Or, you could
>   simply edit configure.)  By `works' I mean under both gcc and cc.

I changed configure since I don't have autoconf etc. installed.
Your solution works when compiling with gcc! I haven't tried cc yet but will
do so tomorrow.

> * If so, this is the short-term fix we could go for.  If not, we may
>   need to infer wl for non-gcc from libtool, which is doable.
> * It may be useful to report the discrepancy to the TclTk maintainers.

I'll try to compile tcl and tk with gcc and send in reports.

> * Provided they fix the problem, we need to think about better
>   strategies.  (Something like if wl is not the empty string and
>   TK_LIB_SPEC does not start with it then add it as prefix.)  But let us
>   not worry about this now.

Do you really want to go this way?  Is AIX the only OS where you can run
into this kind of trouble?  If so, why not add a compilation of a little
test program  in configure in case you have os==AIX, that would use the same
flags that you'll use in library/src/tcltk.c?  If that fails, it's flagged
early on and directly points to the tcl/tk installation (and not to R).


Email: vogels@cmu.edu

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch