From thomas@biostat.washington.edu  Sat Mar 18 19:18:20 2000
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Sat, 18 Mar 2000 11:18:20 -0800 (PST)
Subject: [Rd] AIX fails on startup with R-1.0.0
In-Reply-To: <x2hfe4czpj.fsf@blueberry.kubism.ku.dk>
Message-ID: <Pine.GSO.4.21.0003181111590.11158-100000@mail.biostat.washington.edu>

On 18 Mar 2000, Peter Dalgaard BSA wrote:

> Thomas J Vogels <tov@ece.cmu.edu> writes:
> 
> > Hi,
> > 
> > this is not a bug report since this may not be a problem with R per se. 
> > 
> > The current release of R (1.1.0) will compile cleanly on an AIX box
> > (I have 4.3.2) but it will fail upon startup with an Illegal
> > Instruction.  I've located the problem to be in do_strsplit when R
> > calls regcomp.
> > 
> > This function is defined in regex.c.  However, the text from regex.o
> > doesn't find its way into the executable, R.X11, since there's also a
> > regcomp in /usr/lib/libc.a  Apparently, this confuses the system
> > enough to completely lose its mind.  When regcomp in libc.a gets
> > called, the stack is trashed which made this hard to debug.
> > 
> > A temporary fix is to remove the _first_ use of -lc from the linker
> > command line.  This will affect the way the export symbols are
> > defined.  Not sure yet whether this matters.
> > 
> > Why does this bug only show up on AIX?  Is this some weird posix trap?
> 
> We've discussed this recently (others know better than me). I think
> you have it spot on, and the problem is that almost all other systems
> than AIX will have the linker implicitly move -lc *after* the .o
> files... AFAIR the permanent fix is equivalent to your temporary one.


It's actually a combination of a number of factors.  On most systems we
link with the C compiler, which knows what to do with libc automatically.  
In any case, many linkers can handle the problem as Peter points out.

On AIX we were using ld rather than CC to link, and ld doesn't move -lc to
the end, and we were using a hardcoded set of linker options that some
helpful user had sent in a long time ago (no-one in R-core has very
convenient access to AIX). It worked fine until we added GNU regex to R.

The fix was what you suggest.

	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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] AIX fails on startup with R-1.0.0
Thomas Lumley