Lessons learned on how to build 7.0.2 on AIX 4.x - Mailing list pgsql-hackers

From rsand@vgalleries.com (Richard Sand)
Subject Lessons learned on how to build 7.0.2 on AIX 4.x
Date
Msg-id 036101bfe6f9$26342520$0101010a@sandbox.vgalleries.com
Whole thread Raw
Responses Re: Lessons learned on how to build 7.0.2 on AIX 4.x
List pgsql-hackers
Hi all-  I've recently had to suffer a torturous process of building 7.0.2 on AIX 4.3.2.  From my pouring through other newsgroups I've concluded that the problems I've hit exist at least on AIX 4.1.5 and 4.3.3 as well.  This note describes the problems I've encountered and how to get around them, as well as a request for some fixes.  Please accept my apology if this is known information- I couldn't find anything in this digest here.  Some of this is in the document FAQ_AIX, but not all of it.
 
1) First of all, you can't use IBM's make utility, gotta use GNU make.  So download gmake from http://www-frec.bull.com/docs/download.htm (where its put into an AIX installp package).  Be sure to rename /usr/local/bin/make to /usr/local/bin/gmake so as not to confuse it with AIX's make.
 
2) Now, when you first download postgres and try to run the configure program, if you are using GCC instead of the AIX compiler (which is expensive), you have to use the command:
 
./configure --with-template=aix_gcc

This forces GCC.  I used GCC 2.95.2. 
 
2a) If you need to install GCC there are some AIX packages you need.  I installed GCC and typed "gcc" and it responded "No input files found".  Sounds good.  But when I tried the configure command again it still fails to find a compiler.  So I write a little test program and try to compile it and it gives me an error "installation problem, cannot exec `as'".  Well, as it turns out, AIX doesn't install the assembler by default, you have to go and install the package "bos.adt.tools".  That's a wonderful IBM brainchild. :)  Ok, that's that mystery solved.
 
2b) Next, it gave me errors looking for a c++ compiler, so be sure to download gcc.g++.2.95.2 which installs AFTER gcc.2.95.2.
 
2c) Well, then I try compiling my test program with g++ and it complains about finding libm.a, so now we have to install the package "bos.adt.libm".  So dumb. :)
 
3) Ok so we're finally ready to build, and as soon as I type 'gmake', I get this error: 
 
Making postgres.imp
 ./backend/port/aix/mkldexport.sh postgres /usr/local/bin > postgres.imp nm: postgres: 0654-200 Cannot open the specified file.
 nm: A file or directory in the path name does not exist.
 
This is apparently a bug in the make scripts for Postgres.  I did find a workaround which was documented in one of the newsgroups.  I went into the ./src/backend directory and did 'gmake', and even though it failed I then copied the ./src/backend/postgres.imp file to ./src, and that seemed to correct the problem.
 
4) So I continue my gmake'ing, and this time it fails badly trying to compile libpq++.so.  The same person that suggested the postgres.imp workaround also said that they couldn't get the c++ portion to compile, so I hand edited the Makefile.global file in ./src and commented out the line "HAVE_Cplusplus=true"
 
This, finally, at long last (and after all the trouble of installing G++ and libm!), got the rest of Postgres 7.0.2 to compile.
 
Oh, and as the make output scrolled by, I see that it failed as well building some plpsql stuff, but it was non fatal.  There were also a zillion warnings, many of them about multiple type declarations for int8, int32, etc.

Now on to the installation!!
 
5) The install worked pretty smoothly.  The only trouble I had was installing the man pages, because it expected to use "zcat" to handle its .gz files, which AIX doesn't like.  So I had to change zcat to "/usr/local/bin/gunzip -c" in the ./src/Makefile.global (of course implying that I had already installed GNU zip).  I added the LD_PATH and MANPATH entries for pgsql to my /etc/environment.
 
I hope this information is helpful to any of you building this on AIX, and hopefully we can have someone from the Postgres team revisit the AIX installation process!  The missing AIX packages stuff could be added to the FAQ_AIX file, and hopefully the error in the makefile and the problem linking libpq++.so can be fixed.  If the latter is a G++ problem (would not surprise me!), keep in mind that many of us AIX users don't use xlC because IBM licenses the damned thing, so GCC is more more economical!
 
Best regards,
 

pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Per-database/schema settings
Next
From: Philip Warner
Date:
Subject: Re: 2nd update on TOAST