From Thomas Vogels <tov@ece.cmu.edu>  Tue Jul 31 16:00:36 2001
From: Thomas Vogels <tov@ece.cmu.edu> (Thomas Vogels)
Date: 31 Jul 2001 11:00:36 -0400
Subject: [Rd] Compiling R (1.3.0) on AIX (4.3) fails (PR#1034)
In-Reply-To: Kurt Hornik's message of "Mon, 30 Jul 2001 19:19:43 +0200"
References: <200107291917.VAA24794@pubhealth.ku.dk>
 <pxsnffpkc8.fsf@infiniti.ece.cmu.edu>
 <pxlml6cxfo.fsf@infiniti.ece.cmu.edu>
 <15205.38703.553276.335905@mithrandir.hornik.net>
Message-ID: <pxbsm1jg8b.fsf@infiniti.ece.cmu.edu>


Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> writes:

> >>>>> Thomas Vogels writes:
> 
> > Excerpt from Kurt's email this morning:
> 
> >>>> > 2) after configure (with CC=gcc but using AIX's linker
> >> /usr/bin/ld), the
> >>>> > Makefile in src/library/tcltk/src doesn't protect the linker
> >> flags
> >> -bI
> >>>> > with -Xlinker! (-Xlinker is required when using gcc so that the
> >> linker flags
> >>>> > are passed on to ld correctly.  Which I know that you know...)
> >>>> >   The fix is to add -Xlinker before every -bI. Sorry, haven't
> >> looked into
> >>>> > patching configure yet...
> >> 
> >> Very strange.  Configure has
> >> 
> >> *aix4.[2-9]*)
> >> EXPORTFILE="\$(top_builddir)/etc/R.exp"
> >> cpicflags=
> >> cxxpicflags=
> >> fpicflags=
> >> wl="-Wl,"
> >> main_ldflags="${wl}-bdynamic ${wl}-bE:${EXPORTFILE} ${wl}-bM:SRE"
> >> shlib_ldflags="${wl}-bM:SRE ${wl}-H512 ${wl}-T512 ${wl}-bnoentry \
> >> ${wl}-bexpall ${wl}-bI:\$(R_HOME)/etc/R.exp"
> >> SHLIB_LIBADD="\$(LIBM)"
> >> ;;
> >> 
> >> so unless I am missing something obvious all linker flages are
> >> protected
> >> via `-Wl,' (which should also work if the C compiler is not gcc).
> >> 
> 
> > Sorry, should have been more explicit, I guess: the problem is with
> > PKG_LIBS (which is the only variable in that Makefile using linker
> > flags...)  Some digging shows that '-Wl,' (or '-Xlinker') is missing
> > in tkConfig.sh.  So if you have Tcl/Tk (8.3 in my case) installed and
> > used AIX's 'cc' compiler, you get in trouble with later using gcc
> > (e.g. for R).  Oddly, this didn't show when compiling, say, Tktable.
> 
> > There is the question, why configure didn't "see" this coming.  What
> > would be nice is a warning to the effect that tkConfig.sh is broken
> > when R can't compile tcltk.c.  (Currently I get messages about libc.a
> > not found...)
> 
> This is asking for a bit much, I think.  How would configure know for
> sure that tkConfig.sh is broken?

I promise to get more sleep soon... 'What would be nice is a warning
to the effect that the Tcl/Tk configuration failed, like:
checking how to compile and link tcl/tk.... failed
'  Asking about tkConfig.sh (or tclConfig.sh) is probably too muc as
threre are other factors that can cause the fail (config.site...).

What this would boil down to is trying to compile e.g. tkAppInit.c and
see whether compilation and linking works.  But even this may
be asking  fortoo much, this is just one architecture.  Things like these
will continue to happen with AIX as long as there are those '.exp'
files around...


> On second thought: the comment in tkConfig.sh says
> 
> 	# String to pass to linker to pick up the Tk library from its
> 	# installed directory.
> 	TK_LIB_SPEC='@TK_LIB_SPEC@'
> 
> so maybe this assumes to be called by ld directly ...
> 
> 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.

Thanks!
  -tom

> 
> -k
> 
> 

-- 
mailto:tov@ece.cmu.edu (Tom Vogels)   Tel: (412) 268-6638   FAX: -3204
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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