Skip to content

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

4 messages · Kurt Hornik, Thomas J Vogels

#
Argh.  After sinking some more time into this ... here's what happens.

Assuming that both tclConfig.sh and tkConfig.sh are found, we do

	TCLTL_LIBS="${TCL_LIB_SPEC} ${TK_LIB_SPEC} ${TK_LIBS}"

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`"    
    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.

I therefore suggest the following.

* Can you try replacing

      TCLTK_LIBS="${TCLTK_LIBS} ${TK_LIB_SPEC} ${TK_LIBS}"

  in m4/R.m4 by

      TCLTK_LIBS="${TCLTK_LIBS} ${wl}${TK_LIB_SPEC} ${TK_LIBS}"

  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.

* 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.

* 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.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Excerpt from email by Kurt Hornik:
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...
... which is wrong, BTW:  TCL_LIB_SPEC should refer to ${exec_prefix}/lib
not `pwd` ...
That would explain why Tcl/Tk compiles with Aix's cc but not gcc.
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.
I'll try to compile tcl and tk with gcc and send in reports.
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).

Thanks,
  -tom

--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
[Well getting AIX right is not that easy.  Fortunately, R has Tom Vogels
to help ...]
You mean in the `-L' part?  Certainly correct ...
Yep.
Ok, great.  My assumption/hope is that this should work ...
I think I want to go this way.  Reason: the current situation is a
mixture of an R bug and a Tk inconsistency.  The R bug is that I had not
realized that the LIB_SPECs are meant as flags to ld.  The Tk problem is
that this is not true.

The whole thing is a bit tricky, and it might be interesting to see how
e.g. GNOME projects deal with this in their -config scripts.  As this is
hidden inside libtool could you maybe try compiling libxml2 on your AIX
system and see what xml2-config --libs does?

Also, what does
	./libtool --config | grep ^wl
give for configuration with native cc?

In general, the portable way would be to have package config scripts use
$wl or alike.  But that will not do in general: someone could have gcc
but a native C++ compiler and $wl might be different between these ...

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Kurt,

here is the update:  With your change in TCLTK_LIBS
TCLTK_LIBS="${TCLTK_LIBS} ${wl}${TK_LIB_SPEC} ${TK_LIBS}"
I can compile with both cc and gcc:

-- using no CC in config.site I'll get gcc and compilation proceeds nicely.

-- using CC=cc in config.site forces compilation with cc and compilation
proceeds with warnings for all modules. E.g. for X11 I get the following:

       cc -Wl,-bM:SRE -Wl,-H512 -Wl,-T512 -Wl,-bnoentry       -Wl,-bexpall
-Wl,-bI:../../../etc/R.exp  -o R_X11.so  dataentry.lo devX11.lo rotated.lo
rbitmap.lo -lSM -lICE -lX11  -L/home/tov/opt/z/lib -L/home/tov/opt/z/lib  -l
dl -lm -lc
cc: 1501-218 file dataentry.lo contains an incorrect file suffix
cc: 1501-218 file devX11.lo contains an incorrect file suffix
cc: 1501-218 file rotated.lo contains an incorrect file suffix
cc: 1501-218 file rbitmap.lo contains an incorrect file suffix

-- Note that I can't just use LIBS and CPPFLAGS to set up the paths to Tcl
and Tk (as in LIBS=-L/home/tov/opt/lib and CPPFLAGS=-I/home/tov/opt/include)
since configure will try compile with -ltcl, i.e. without version number and
so doesn't find libtcl8.4.so.  Use of --with-tcltk=/home/tov/opt/lib works.
(Applies to both, cc and gcc)

-- With CC=cc I get warnings about /usr/include/stdarg.h and
/usr/include/varargs.h stepping on each other's toes with macro
re-definitions.

Excerpt form Kurt Hornik's email from Thursday, August 02, 2001 1:20 AM:
What and where is xml2?
With cc: wl=""
With gcc: wl="-Wl,"
Interestingly I saw today in Tk's configure:

case $SHLIB_LD in
   *ld*)
      TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e
"s|,| |g"`
      ;;
    *)
      TK_LD_SEARCH_FLAGS="${TK_CC_SEARCH_FLAGS}"
      ;;
esac

So they thought about throwing out the -Wl when calling the linker with
flags meant for the compiler.  I think you could turn that around and
add -Wl for linker flags that you pass to the compiler.  (My point being
that the echo&sed combination is saver than just prefixing a variable with
${wl}.)

Thanks,
  -tom

--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._