Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by jwilso » Sun, 12 Oct 2003 10:32:46


ll,

After toying with a few builds of the up coming OS X 10.3 (Panther)
release, I've written a doc on how to get postgresql to build using
Panther build 7B85 and Xcode build 7B85 (which are rumored to be the
gold master and the builds that will be shipping later this month).

Two things needed to be hacked to get postgresql to build from
darwinports, and I'm assuming the same fixes would apply to a build
from a .tar.gz. Essentially, a header file installed by Apple's Xcode
devel tools needs to be edited, and the template for darwin needs a
line removed. This fix is also known to work with OS X 10.3 build 7B85
and Xcode 7B68. Whilst I'm not in a position to analyse the root cause
of why these hacks are needed, this doc is simply a quick and dirty
guide to hacking it together.

Scenario
========

Fresh install of OS X 10.3 7B85
Fresh install of Xcode 7B85

howrare:~ jwilson$ sudo port install postgresql

btodb Compiler Error
====================

Error: Target com.apple.build returned: shell command "cd
"/Library/DarwinPorts/dports/databases/postgresql/work/postgresql
-7.3.2" && CPPFLAGS=-I/opt/local/include CFLAGS=-I/opt/local/include
LDFLAGS=-L/opt/local/lib gnumake all" returned error 2
Command output: gnumake[2]: Nothing to be done for `all'.
gnumake -C backend all
gnumake -C ../../src/port all
gnumake[3]: Nothing to be done for `all'.
prereqdir=`cd parser/ >/dev/null && pwd` && \ cd
../../src/include/parser/ && rm -f parse.h && \ ln -s
"$prereqdir/parse.h" .
gnumake -C utils fmgroids.h
CPP='gcc -traditional-cpp -E' AWK='awk' /bin/sh Gen_fmgrtab.sh
../../../src/include/catalog/pg_proc.h
cd ../../src/include/utils/ && rm -f fmgroids.h && \
ln -s ../../../src/backend/utils/fmgroids.h .
gnumake -C access all
gnumake -C common SUBSYS.o
gcc -traditional-cpp -I/opt/local/include -Wall -Wmissing-prototypes
-Wmissing-declarations -I../../../../src/include -I/opt/local/include
-c -o heaptuple.o heaptuple.c
gcc -traditional-cpp -I/opt/local/include -Wall -Wmissing-prototypes
-Wmissing-declarations -I../../../../src/include -I/opt/local/include
-c -o indextuple.o indextuple.c
gcc -traditional-cpp -I/opt/local/include -Wall -Wmissing-prototypes
-Wmissing-declarations -I../../../../src/include -I/opt/local/include
-c -o indexvalid.o indexvalid.c
gcc -traditional-cpp -I/opt/local/include -Wall -Wmissing-prototypes
-Wmissing-declarations -I../../../../src/include -I/opt/local/include
-c -o printtup.o printtup.c
In file included from /usr/include/machine/param.h:30,
from /usr/include/sys/socket.h:67,
from ../../../../src/include/libpq/pqcomm.h:28,
from ../../../../src/include/libpq/libpq-be.h:24,
from ../../../../src/include/libpq/libpq.h:21,
from printtup.c:20:
/usr/include/ppc/param.h:98: macro "btodb" requires 2 arguments, but
only 1 given
/usr/include/ppc/param.h:100: macro "dbtob" requires 2 arguments, but
only 1 given
gnumake[4]: *** [printtup.o] Error 1gnumake[3]: *** [common-recursive]
Error 2
gnumake[2]: *** [access-recursive] Error 2
gnumake[1]: *** [all] Error 2
gnumake: *** [all] Error 2

Workaround
----------

howrare:~ jwilson$ sudo cp /usr/include/ppc/param.h
/usr/include/ppc/param.h_pgfix
howrare:~ jwilson$ sudo vim /usr/include/ppc/param.h
* Go to line 90 (Type '90gg')

Note this section:

 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by mark » Mon, 13 Oct 2003 02:28:20

James, we've spent some time lately with Mac OS X related changes to
the code base. Please try this again with a fresh CVS copy of
PostgreSQL and let us know if there are any further changes you think
we'd need to work properly with Panther.

Thanks,
mk




---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by jwilso » Mon, 13 Oct 2003 09:52:02

Hi Marko,

I've done a checkout from CVS and performed a build under OS X Panther
7B85 with the non-hacked header files. The problem with the param.h
header file seems to be fixed, however the build is failing with
undefined symbols in libs:

make -C ecpglib all
gcc -no-cpp-precomp -g -O2 -Wall -Wmissing-prototypes
-Wmissing-declarations -bundle execute.o typename.o descriptor.o
data.o error.o prepare.o memory.o connect.o misc.o
-L../../../../src/port -L/opt/local/lib -L../pgtypeslib -lpgtypes
-L../../../../src/interfaces/libpq -lpq -lm -o libecpg.so.4.0
ld: Undefined symbols:
_PQfreemem
_PQresultErrorField
_PQsetNoticeReceiver
_last_path_separator

I noticed it's not linking with the "-undefined suppress" flag which
I've found it required when building 'bundles' for darwin.

Cheers,




-------------------
James Wilson
CCIE #6662

LithiumCorp Pty Ltd

mobile: 0422 22 3742
email: XXXX@XXXXX.COM


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by mark » Mon, 13 Oct 2003 18:18:31


I believe you have some old files lingering on your tree:

[marko:~/src] mka% rm -rf pgsql
[marko:~/src] mka% cvs -z3 -d
:pserver: XXXX@XXXXX.COM :/projects/cvsroot co -P pgsql
[marko:~/src] mka% cd pgsql
[marko:~/src/pgsql] mka% autoconf
[marko:~/src/pgsql] mka% ./configure
. . .
[marko:~/src/pgsql] mka% make
. . .
All of PostgreSQL successfully made. Ready to install.
[marko:~/src/pgsql] mka%

Either that, or your usage of mismatching OS X and dev tools versions
is causing you problems.

mk


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by tgl » Thu, 16 Oct 2003 03:03:36

James Wilson < XXXX@XXXXX.COM > writes:

I'll bet you have an old libpq in /opt/local/lib. Why is that getting
included in the link anyway?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to XXXX@XXXXX.COM )
 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by jwilso » Thu, 16 Oct 2003 09:56:35

Nicely spotted, yeah that's what is causing these issue. The reason
-L/opt/local/lib is in there is due to it being ./configured with
--with-libraries=/opt/local/lib and --with-includes=/opt/local/include.
Those configure options are necessary to ensure the configure found the
darwinport-installed readline et.al. which are in /opt/local/lib and
/opt/local/include

Removing the old postgres libs would resolve this build issue, but
makes it a bit painful for users upgrading from an existing
installation.



-------------------
James Wilson
CCIE #6662

LithiumCorp Pty Ltd

mobile: 0422 22 3742
email: XXXX@XXXXX.COM


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by kgleaso » Thu, 06 Nov 2003 04:32:24

After spending a few hours of trying to get Postgresql7.3.4 to build
from source (tar.gz) on a Panther (release, not beta) system, I find
that I am still having the same errors described in the original post
to this thread. It is a clean install as of yesterday, with readline
installed via fink.

# ./configure --with-includes=/sw/include/ --with-libraries=/sw/lib
--with-perl

then:

#make

yields this error at then end:

In file included from /usr/include/machine/param.h:30,
from /usr/include/sys/socket.h:67,
from ../../../../src/include/libpq/pqcomm.h:28,
from ../../../../src/include/libpq/libpq-be.h:24,
from ../../../../src/include/libpq/libpq.h:21,
from printtup.c:20:
/usr/include/ppc/param.h:98: macro "btodb" requires 2 arguments, but
only 1 given
/usr/include/ppc/param.h:100: macro "dbtob" requires 2 arguments, but
only 1 given
make[4]: *** [printtup.o] Error 1
make[3]: *** [common-recursive] Error 2
make[2]: *** [access-recursive] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2


I have installed the XCode tools that came with Panther and ran
Software update to get everything up to date. Is there another
(better?) way to fix this than altering the header files as James
inidcated in his original post? there is no /opt, so I don't think it
is a lingering library there.

Kirk Gleason
 
 
 

Hacking PostgreSQL to work in Mac OS X 10.3 (Panther 7B85)

Post by tgl » Thu, 06 Nov 2003 06:55:08


XXXX@XXXXX.COM writes:

Try 7.4RC1 instead. Apple made some incompatible changes in their
compiler in Panther.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to XXXX@XXXXX.COM )