Skip to content

AIX fails on startup with R-1.0.0

16 messages · Peter Dalgaard, Thomas Lumley, Erich Neuwirth +4 more

#
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?

Thanks,
  -tom
#
Thomas J Vogels <tov@ece.cmu.edu> writes:
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.
#
On 18 Mar 2000, Peter Dalgaard BSA wrote:

            
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
for all of you using the windows version:
i think having a look at the r-winedt
interface by volker ligges is a good idea.
it works quite nicely.

i talked to volker,
and at the moment,
there is something which could be improved,
anmley it would be nice if one could get access to the current
history buffer.

is there a way of getting it
(i.e. exactly what would be saved in .Rhistory if one were to exit right
now)?

then one could interactively edit the current session
in winedt.
Peter Dalgaard BSA wrote:
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Thomas Lumley <thomas@biostat.washington.edu> writes:

[snip]
On AIX you have to build the export file, R.exp, which was the reason
to force the use of ld, I believe.  Also, the libs must be on the
command line for ldAIX to include exported symbols from libc.a in
R.exp (which reduces the size of shared libs).
ok, now I understand why this problem didn't occur until 1.0.  I
glanced at Makeconf.  There is the '-lc' (along with '-lm') in the
DLLFLAGS but also in SHLIBLDFLAGS -- do you plan to export regexec and
friends?  Because the creation of shared libs with an early -lc will
create the same Illegal Instructions...

Thanks,
  -tom
#
Erich Neuwirth schrieb:
I just uploaded a new "version" of R-WinEdt with some improvements /
bugfixes and enhanced ReadMe to CRAN (Erich Neuwirth already has got
it).

The latest release is also available at 
http://www.statistik.uni-dortmund.de/leute/ligges.htm


Thanks for all comments!

Uwe Ligges
^^^  ;-)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
2 days later
#
Can you have a look at the current r-devel snapshot?  The way I think my
code works is by adding to R_XTRA_LIBS, which should only be used when
linking the main binary, but not when creating shared libraries.

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

ok, the main binary builds, but not ctest.so.  Here is the head of the
linker output:

$ ld -bM:SRE -H512 -T512 -bnoentry -bexpall       -bI:../../../../etc/R.exp  -o ct
est.so ansari.o fexact.o kendall.o ks.o prho.o swilk.o  -L/usr/local/lib -L/afs/
ece/usr/tov/opt/arch -lblas  -lxlf90 -lxlf -lxlomp_ser -lm
ld: 0711-317 ERROR: Undefined symbol: .sprintf
ld: 0711-317 ERROR: Undefined symbol: .itrunc

... and so on.  It's dearly missing -lc.  I've tried adding -lc and
that allowed at least ctest.so to link.  But where should -lc be added
for shared libs to link with?

Thanks,
  -tom

(I used rsync to get r-devel (date-stamp is 2000/March/22).)


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

[snip]

  
    
#
Tried adding to LIBS now.  Pls check.

-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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
2 days later
#
On Sun, 19 Mar 2000, Erich Neuwirth wrote:

            
Is WinEdt not shareware?  That dampens my enthusiasm for using it with
an Open Source project.
#
yes, you are right.
winedt is shareware.
Prof Brian D Ripley wrote:
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
You are right.
I thought it would be nice for some Windows users, which are using
WinEdt already as a TeX-Editor and don't like emacs very well.

Best regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
2 days later
#
Kurt,

thanks for your help.  Your suggestion to use "LDCMD=cc SHLIBLD=cc"
for configure worked, I've got a working R again :-)

Other roadblocks I've encountered (and the reason I cc: r-devel):

-- ld/cc doesn't automatically include /usr/local/lib while gcc does.
This comes from the sytem installation here and has nothing to do with
R.  But having to add LIBS=-L/usr/local/lib may come as a surprise to
people who don't do this regularly.  Does configure check for the
existence of e.g. libz.a with cc or gcc?

-- the installation fails when I try to build in a special
subdirectory.  install-sh can't be found.  I've edited the Makefile to
use "build/tools/../$(INSTALL_DATA)".  (I guess build/$(INSTALL_DATA)
would be enough.)  I believe this worked on a sun.  Is this a
consequence of overriding install-sh on AIX in configure?

-- demo.so is not installed and demo(dyn.load) fails.  This is a
trivial matter if detected before 'rm -rf build' ...

-- there used to be a memory glitch when exiting R on AIX (and I think
Alpha).  This was fixed, but I now get this weird xmalloc statement
before startup:

$ echo "x <- 1; q()" | R BATCH
$ cat .R.Rout 

R : Copyright 2000, The R Development Core Team
Version 1.1.0 Under development (unstable) (March 27, 2000)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type    "?license" or "?licence" for distribution details.

R is a collaborative project with many contributors.
Type    "?contributors" for a list.

Type    "demo()" for some demos, "help()" for on-line help, or
        "help.start()" for a HTML browser interface to help.
Type    "q()" to quit R.

[Previously saved workspace restored]

xmalloc: out of virtual memory
R> invisible(options(echo = TRUE))
R> x <- 1; q()


Thanks again for getting R running on AIX again,
  -tom
#
Thomas J Vogels <tov@ece.cmu.edu> writes:
Hmm. What's in that previously saved workspace?  Can you zoom in a
little closer on where that error comes from?

(And note that the save bug is not actually fixed in R-devel yet -
will happen as soon as I merge in from the "release" branch)
#
Peter,

ah, stupid me.  I've put the braces "back" into system.c to guard
write_history(), et voila, it works.  I was simply confused by the
error message showing up before the R prompt instead of the very
end...
Regards,
  -tom


Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:
[snip]

  
    
2 days later
#
And got me confused.

Ideally, I'd like to use the C compiler (rather than ld) for linking the
main binary as well as shared libs, so overriding should only occur if
there is a good reason.  I assume that there was one for aix, but from
the above maybe it is gone now?

Users of current r-devel snapshots on AIX, can you confirm that

	MAINLD=cc SHLIBLD=cc /path/to/configure
	make

works o.k.?  (Or actually, use your C compiler rather than `cc' ...)
It uses the C compiler specified.

Well, LIBS is needed when you have things in `non-standard' locations.
Of course your mileage may vary on the definition of non-standard :-)

Is there anything I/configure could do about this?  (Note that I don't
think that unconditionally adding /usr/local/lib to LIBS is a good
idea.)
I need more info on that.  configure does two fixing steps after using
the standard autoconf code for determining a BSD compatible install: if
we end up with the script, then make sure its path is absolute.  I think
this is needed and should work.  Secondly, on platforms where the code
was known to give something that would not work, use the script in any
case.  Maybe the latter can be avoided with the most recent autoconf
code.

What exactly is the failure you observe?
Why is that?

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