$Id: classpath-0.10-on-AIX.txt,v 1.1 2004/07/21 20:52:42 augart-oss Exp $
@author Steven Augart
@date 21 Jul 2004

Building Classpath 0.10 on AIX

[This was originally sent as a message to the jikesrvm-core mailing list]

David P Grove wrote:

>
> We've been having problems getting classpath 0.10 to build on our AIX machines.  We're going to hold the 2.3.3 release for one more day to attempt to get that resolved.  If that doesn't fly, then we may have to release recommending classpath 0.08 on AIX and 0.10 on all of our other platforms.  Not a happy situation, but it may be the best option available.  Opinions or other ideas on how to proceed?  Has anyone outside of watson built classpath 0.10 on AIX 5 (it could be a local wierdness on our machines, which are not vanilla AIX 5 boxes)?
>
> --dave


Here's what I had to do to get Classpath 0.10 to build on AIX 5.  It's
actually very easy (just three steps); don't be put off by the length
of this letter.  Most of the text is explanations for why the steps
are needed.

This letter is really a first draft of what I need to stick into the
user's guide, with a warning in the release notes.

1) Give the following arguments to "configure" when you configure GNU Classpath:
    --with-jikes=<wherever jikes is> --disable-gtk-peer \
    "CFLAGS=-D_POSIX_SOURCE -D_ALL_SOURCE -D__ppc__"

Rationale:

a) I suggest you explicitly specify where "jikes" is, to be safe.  You
don't want to use the GCJ version 3.3.3 that is available with AIX
5.1.1; it will fail to compile Classpath.  If you have a program named
"jikes" in your search path, then GNU Classpath's autoconfiguration
process will use it by default; otherwise, it won't.

b) If you didn't specify --disable-gtk-peer, you'd have to install
"pkg-config", and the following libraries (at least) which don't seem
to be on AIX: atk, pango, gtk, glib2.  Classpath's AWT code needs
Jikes RVM to hijack the select() and poll() system calls, but that
hijacking is not implemented for AIX.  Since AWT won't work anyway,
there's no point in making the effort to download and install packages
that are only needed for the AWT support.

c) The -D__ppc__ is needed on GCC version 3.3.3, at least, where the
compiler doesn't define __ppc__ on the PowerPC.  Obviously, if you're
running AIX on a machine that's not a PowerPC (I don't know whether
IBM sell AIX for the x86, but in case they do) then you'll have to
change that part.

I assume that this problem did not arise for us at Watson before
because we recently upgraded the versions of AIX and GCC on
"munchkin", the server we've always used for our AIX builds.  That
machine is now running AIX 5.1.

d) the -D_POSIX_SOURCE forces absolutely necessary stuff to be
defined.  For example, <sys/stat.h> won't bother defining a "struct
stat" unless _POSIX_SOURCE is defined.  That seems insane to me, since
<sys/stat.h> has always contained a "struct stat" ever since early
versions of Unix, but there you have it.

e) the -D_ALL_SOURCE is needed to get a few definitions to appear in
the AIX header files, such as getting <sys/types.h> to define a type
named "u_short".  (The comment in the AIX header file claims that
u_short is a BSD-ism.  If so, Classpath should probably be fixed not
to use it.)


2) After you configure the build directory, hand-edit the file
   native/fdlibm/Makefile; change the line that defines CFLAGS to
   remove the string "-D_ALL_SOURCE".

Rationale:

If you do define _ALL_SOURCE here, then one of the AIX header files
will include the (ridiculous) macro: 
    #define hz 100
Unfortunately, one of the C source files in native/fdlibm contains a
local variable named "hz".  Ouch. 


3) Run "make" as usual in your Classpath build directory.
