Re: Almost succesfull build on AIX

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: Almost succesfull build on AIX
From: Kurt Hornik (
Date: Mon 12 Jul 1999 - 16:53:12 EST

Message-ID: <>

>>>>> Thomas Vogels writes:

> These are some notes about compilation of R-devel (1999-July-08):

> -- Compilation breaks when using gcc due to a bug in the include
> files. gcc is version 2.8.1. In the files Defn.h, Rsock.c and
> sock.c, I had to add "typedef long blkcnt_t" which somehow is not
> found in sys/types.h. This may be specific to my installation or to
> this version of gcc.

I cannot confirm this with 2.7.1 (!). I could add

        AC_CHECK_TYPE(blkcnt_t, long)

to but I'd want to be sure this is really needed.

> -- The linking stage breaks because it can't find libz.a and
> libncurses.a. I can't quite figure out why R.X11 would want them.
> This appears to be a new feature in configure.

Very strange. Are you saying that -lz and -lncurses are detected at
configure time but not found at compilation/link time? (Could it be
that they are in /home/opt/arch/lib?) Note (see also below) that you
really should use LIBS and not LDFLAGS for -L and -l stuff.

> BTW, for the readline lib I need -lcurses (note no n).

Need? Better not ... any of ncurses, termcap or termlib would be o.k.
(See also above.)

> -- Sorry, I forgot to pass this on: You (Kurt) should try to link with
> ld not with gcc. (This will cover up that I have no clue why -L<path>
> wouldn't pick up libgcc.a.) So the DLLFLAGS should contain -L<path>
> -lgcc where path is taken from "gcc --print-libgcc-file-name"

As I already wrote, I'd like to. Problem is we need to know which libs
(such as -lc -lm) to link against ... I'll do something about DLLFLAGS
as suggested.

> Here is the deal with LDCMD/SHLIBLD as far as I understand it:

> -- For the R binary (R.X11) we need:
> == LDCMD: ld (native linker)
> == DLLFLAGS: mainly the export symbol flags
> ("-bdynamic -bE:${EXPORTFILE} -bM:SRE") and libraries ("-lc -lm
> -l<fortran libs>", if CC==gcc libgcc.a as well);
> but also the LDFLAGS (see buttom).

The Fortran libs are not needed because they are in FLIBS anyway. Is
`-lc' and maybe `-lgcc' if GCC really enough?

> -- For shared libraries (like we need:
> == SHLIBLD: ld
> == SHLIBLDFLAGS: again the symbol stuff
> ("-bM:SRE -bnoentry -bexpall -bI:${EXPORTFILE}"), maybe libraries

> Below is some code that can figure out which libraries to use and
> where they are. "ld -bnobind" does the work, providing us wiht lines
> like "i array.o" or "lib /usr/lib/libm.a". This code would put all
> symbols that are in R.X11 (not just all the .o and .a files) into the
> export file. Advantage: If the shared libs don't need any more
> libraries than R, we are set and don't need any libraries (-lm etc) in
> SHLIBLDFLAGS. Disadvantage: We have to make sure that everything
> from the libraries actually makes it into R. Dunno.

> -- warning shell script ahead, avert eyes --
> ld -bnobind "$@" |
> sed -n -e 's/^i /. /p' -e 's/^lib \(.*\)/\1 \1/p' |
> (
> while read a b; do
> echo 1>&2 "$a $b"
> echo "#! $a" >> $mainexp
> $nm $nmopts $b |
> awk '
> $2 == "T" && $1 ~ /^\.[^_]/ { found[substr($1, 2)] = 1 }
> $2 == "D" { text[$1] = 1 }
> $2 == "B" && $1 ~ /^[^_]/ { bss[$1] = 1 }
> END {
> for (x in text)
> if (found[x]) print x;
> for (b in bss)
> print b;
> }' |
> sort | uniq >> $mainexp
> done
> )
> -- you may now open your eyes again --

> My suggestion would be: - fix ldAIX so that it helps finding all the
> libs and we can use ld as the linker command. (I can do this). -
> leave the libs in SHLIBLDFLAGS. This makes the shared libs a little
> bit bigger but we are on the save side.

Hmm ... we need to determine DLLFLAGS and SHLIBLDFLAGS at configure
time. The above would only work at run time, right? I can see that
this is not a problem with DLLFLAGS because we could wrap things into
the ldAIX script, but how could we do this with SHLIBLDFLAGS then?

> This is new but may help: If I want to have my local copy of
> readline linked into R, I have to set in my
> CPPFLAGS=-I/home/opt/share/include
> LIBS=-lcurses
> LDFLAGS=-L/home/opt/arch/lib

> I can't put the path to my libreadline.a into LIBS, this would fail.
> I need a seperate way of telling to the linker where to find local
> libs, which is what LDFLAGS is meant for. BUT DLLFLAGS does currently
> not include the LDFLAGS.

Maybe I should add LDFLAGS to the LD-like rules.

Re LIBS, why does this not work (as it should)?

> It's still compiling the docs. make check will have to wait till
> tomorrow.

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:

About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:05 EST