Building PgSQL 7.4.2 on SGI Irix 6.19

From: David Turover <dturover(at)student(dot)santarosa(dot)edu>
To: pgsql-ports(at)postgresql(dot)org
Subject: Building PgSQL 7.4.2 on SGI Irix 6.19
Date: 2004-03-30 19:29:14
Message-ID: Pine.LNX.4.44.0403301115080.953-100000@student.santarosa.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches pgsql-ports

note: gmake check had a few out-of-order errors like this:
*** 1732,1739 ****
| 6 | 6 | six |
| 7 | 7 | seven |
| 8 | 8 | eight |
- | | | null |
| | 0 | zero |
(13 rows)
--- 1732,1739 ----
| 6 | 6 | six |
| 7 | 7 | seven |
| 8 | 8 | eight |
| | 0 | zero |
+ | | | null |
(13 rows)

I'm not sure how serious a problem this is.
My configure&etc patches are at the end of this message.

----------------

Installing PostGreSQL 7.4.2 on SGI Irix 6.19

Summary:
(install dependencies)
cp *.patch postgresql-7.4.2
cd postgresql-7.4.2
patch -p1 < _pg_config_programs_m4.patch
autoconf
export PATH=/usr/freeware/bin:$PATH
./configure --with-whatever
gmake
gmake check

Patches: Copy the patches you want (READ THE DESCRIPTIONS!)
to the postgres source directory, install them and run autoconf
to generate a new configure script:

patch -p1 < patchname.patch
autoconf

1) The configure.in patch just squelches a bunch of warnings
in the config.log. It's not necessary unless you think
you'll run into errors you'll need to debug.

2) The config/programs.m4 patch adds -lcurses to the command line.
If you don't use it, you'll get undefined symbol errors
trying to compile with readline support.

3) The template/irix5 patch adds the commands to turn on threading.
It is untested! Don't expect your server to work if you use this.

Generic problems: Using zsh 3.0.8, configure will often quit
at a random point in the middle of running, claiming it received
a sigint. This is probably a bug in zsh. Try opening a new shell
and re-running configure from there.

Readline support: SGI Freeware's readline 4.3 package installs
the libraries to the wrong directory. You will need to move
the N32 (mips-3) readline libs from /usr/lib to /usr/lib32
or else the linker won't detect -lreadline. Use the file command
to see what ABI the libraries are using.

You will also need the programs.m4 patch to add -lcurses to the
gcc command line, or else you will get errors like this:
189218:./conftest: rld: Error: unresolvable symbol
in /usr/lib32/libreadline.so.4: tgetent

Java support: You'll need to install Java and ant and ant's dependencies,
which is a difficult and sparsely documented task in itself. SGI has
a java inst package available for download, or you can grab the latest
version from Sun. As for ant's dependencies, I just grabbed everything
on Apache's website since the docs say ant needs just about all of them,
sorted it all into one directory except for a few packages that were
obviously standalone and unnecessary, moved this mess into java2
so I don't have to deal with setting classpath to two dozen different
directories, set all the java PACKAGE_HOME variables to $JAVA_HOME,
and prayed. It survives configure, but is otherwise not tested.

Notes on java support:
1) (important): Make sure that ant.jar is the full one from
the ant package, not a stripped-down version from one of its
dependencies which depends upon ant. You need the real thing,
otherwise you will get java.lang.InstantiationException:
org.apache.tools.ant.Main

2) Ant takes upwards of a minute just to load itself.
As far as I can tell, this is normal behaviour.
configure may /seem/ hung on ant, but just be patient.

Perl support: Irix has two versions of Perl. SGI uses perl 5.0
in the main tree, but the newer 5.6.1 is available from freeware.
Perl 5.0's libs do not define EXTERN_C, causing gmake to break
in src/pl/plperl/plperl.c. 5.6.1 has EXTERN_C defined, but 5.6.1's
Dynaloader.a breaks on "./ldtmpa01Ns3/DynaLoader.a(DynaLoader.o).B":
Error: Invalid format revision (WHIRL::0.31:) for intermediate compiler file

Temporary Solution 1 (using perl 5.0):
1: export CFLAGS="-DEXTERN_C=extern $CFLAGS"

Temporary solution 2 (using perl 5.6.1) (theoretical, haven't tried):
1: Rebuild perl 5.6.1 from source, without -IPA
2: Copy over the Dynaloader.a
3: Put /usr/freeware/bin before /usr/sbin in path
and export it before running configure. Easiest way,
in zsh: export PATH=/usr/freeware/bin:$PATH
4: Add to your configure command:
--with-libraries=/usr/freeware/lib/perl5/5.6.1/irix-n32/CORE/libperl.so
--with-includes=/usr/freeware/lib/perl5/5.6.1/CORE

Python support: As long as the freeware python packages do not install
shared libraries, you cannot get python support without compiling
python yourself. I haven't tried this, so I'm not sure if it will work.

GNU Tar support:

Irix uses an old, b0rked version of tar which breaks on long pathnames.
If you have GNU Tar installed, you need to put /usr/freeware/bin
at the front of your path before running configure. I don't know
when or where Postgres uses tar, but it's in the Makefile.global file,
so it's worth mentioning.

XML Support:

First, install libxml2 from freeware. Then in contrib/xml/Makefile:
CFLAGS := -I/usr/freeware/include/libxml2 -L/usr/freeware/lib32
gmake, su, gmake install.

where "test" is the name of your database:
psql -f ~pgsql/share/contrib/pgxml_dom.sql test

PostGIS Support (as of .8.1):

Find and install Geos and Proj from source. Find and untar PostGIS source
in contrib. In Makefile, set USE_PROJ=1 and USE_GEOS=1 if they aren't already.

*important!* manually run, since the makefile doesn't catch this:
gcc -c postgis_geos_wrapper.cpp -I/usr/local/include/geos

gmake, su, gmake install.

where "test" is the name of your database:
~pgsql/bin/createlang plpgsql test
psql -f ~pgsql/share/contrib/postgis.sql -d test
psql -f ~pgsql/share/contrib/spatial_ref_sys.sql -d test

PostGIS JDBC:

Add your postgres installation's share/java directory to $CLASSPATH,
or add the files therein to an existing $CLASSPATH directory.
Find your postgres's share/java/postgis.jar file and unzip it.
cd contrib/postgis/jdbc. Edit Makefile, change $CLASSPATH
to the location of the unzipped jar file plus the current directory:
On my system, this is: CLASSPATH = /usr/java2/lib:.

in jdbc/examples/TestServer.java, find these lines:
((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
and replace them with:
((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");

then find these lines:
String dbname = "tb";
String dbuser = "dblasby";
String dbpass = "";
String dbhost = "ox";
String dbport = "5555";
And replace this with the correct information to your server.
Make sure that you have created a test database and a user for this,
that you are using the correct port (usually 5432, not 5555),
that postmaster is running with -i to allow TCP connections,
and that your host-based authentication (data/pg_hba.conf) is set
to allow connections from your system.

gmake, gmake test, gmake jtest

You'll have to install postgis-jdbc manually by copying it to your $CLASSPATH:
cd org, su, cp -R postgis /usr/java2/lib/org

-------------
Appendix 1: dmt's configure script (It compiles, ship it):
./configure --with-ssl=/usr/freeware/lib/openssl --enable-thread-safety \
--enable-integer-datetimes --enable-debug --enable-depend --enable-cassert \
--with-tcl --with-perl --with-java \
--with-tclconfig=/usr/freeware/lib --with-tkconfig=/usr/freeware/lib

-------------
Appendix 2: dmt's patches to PostgreSQL 7.4.2

--- a/config/programs.m4 Tue Mar 16 08:04:54 2004
+++ b/config/programs.m4 Thu Mar 11 11:11:02 2004
@@ -87,9 +87,9 @@
pgac_save_LIBS=$LIBS
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
AC_TRY_LINK_FUNC([readline], [[
- # NetBSD and OpenBSD have a broken linker that does not
+ # Irix, NetBSD, and OpenBSD have a broken linker that does not
# recognize dependent libraries
- case $host_os in netbsd* | openbsd* )
+ case $host_os in netbsd* | openbsd* | irix* )
case $pgac_lib in
*curses*) ;;
*) pgac_lib=" -lcurses" ;;
--- a/configure.in Thu Mar 11 08:42:19 2004
+++ b/configure.in Thu Mar 18 09:04:46 2004
@@ -651,11 +651,21 @@
then
AC_CHECK_LIB(bsd, main)
fi
+# Irix has nsl, socket, gen, and sun in its libc, but also
+# keeps separate libs around for backwords compatibility.
+# Using them creates warnings in config.log. This test quiets that.
+# See also: http://freeware.sgi.com/howto.html
+# Also consider changing the portname, since I'm doing this on irix 6.19
+if test "$PORTNAME" != "irix5"
+then
+AC_CHECK_LIB(nsl, main)
+AC_CHECK_LIB(socket, main)
+AC_CHECK_LIB(gen, main)
+fi
+
AC_CHECK_LIB(util, setproctitle)
AC_CHECK_LIB(m, main)
AC_CHECK_LIB(dl, main)
-AC_CHECK_LIB(nsl, main)
-AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(ipc, main)
AC_CHECK_LIB(IPC, main)
AC_CHECK_LIB(lc, main)
@@ -663,7 +673,6 @@
AC_CHECK_LIB(ld, main)
AC_CHECK_LIB(compat, main)
AC_CHECK_LIB(BSD, main)
-AC_CHECK_LIB(gen, main)
AC_CHECK_LIB(PW, main)
AC_CHECK_LIB(resolv, main)
AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
--- a/src/template/irix5 Thu Mar 18 09:06:08 2004
+++ b/src/template/irix5 Tue Mar 16 10:49:22 2004
@@ -0,0 +1,3 @@
+THREAD_SUPPORT=yes
+NEED_REENTRANT_FUNCS=yes
+THREAD_LIBS="-lpthread"

-------------
Appendix 3: dmt's patches to PostGIS 0.8.1
--- a/jdbc/examples/TestServer.java Fri Apr 19 08:14:17 2002
+++ b/jdbc/examples/TestServer.java Thu Mar 25 10:55:00 2004
@@ -32,8 +32,8 @@
String url = "jdbc:postgresql://" + dbhost + ":" + dbport + "/" + dbname;
conn = DriverManager.getConnection(url, dbuser, dbpass);
System.out.println("Adding geometric type entries...");
- ((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
- ((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
+ ((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
+ ((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");
Statement s = conn.createStatement();
System.out.println("Creating table with geometric types...");
//table might not yet exist

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-03-30 21:52:16 Re: [COMMITTERS] pgsql-server/ oc/src/sgml/datatype.sgml
Previous Message Bruce Momjian 2004-03-30 16:20:09 Re: Dates BC.

Browse pgsql-ports by date

  From Date Subject
Next Message Mary O'Donovan 2004-04-01 07:47:00
Previous Message HockeyHawk 2004-03-29 09:42:21 no SuSE RPM's since V7.4.0. Why?