How can I make a two arch libpq for snow leopard? - Mailing list pgsql-general

From Jerry LeVan
Subject How can I make a two arch libpq for snow leopard?
Date
Msg-id D8E7929D-0D02-43EC-AB20-B496033E0C38@eku.edu
Whole thread Raw
Responses Re: How can I make a two arch libpq for snow leopard?  (Scott Ribe <scott_ribe@killerbytes.com>)
List pgsql-general
Hi,

I have a i386 version of postgresql 8.4.1 created by setting
export CC="gcc -arch i386" an then doing the config, make and make
install.

In particular libpq is an i386 library.

Now I use two database 'adaptors' psycopg2 for python and pgtcl-ng for
tcl.

The python I use is from python.org (2.6.2). It is a 32 bit system.
I can compile psycopg2 with the above python and it seems to be
working ok.

If I compile psycopg2 against the Apple python (2.6.1) I need to
tell Python to run in thirty two bit mode else there will be
libpq link problems.

In order to use psycopg2 with the Apple python I then have to
tell python to run in 32 bit mode using
VERSIONER_PYTHON_PREFER_32_BIT=yes

On the other hand...

The does not appear to be a nifty switch to tell Apple's Tcl to run
in 32 bit mode.

Inorder to compile pgtcl-ng (aka pgtcl 1.7.0 ) I have to do a
32 bit compile by setting export CC="gcc -arch i386" then
doing a configure, make and install.

A standard compile trys to build a 64 bit object but fails because
libpq is only a 32 bit library.

The i386 compile "works" but tcl cannot load the resulting shared
library
with bad architecture error ( I guess it wants 64 bit).

Now I also have an ActiveState 32 bit version of tcl and compiling
pgtcl-ng
against the active state tcl gives a loadable extension.

So the question is:

How can I build a libpq.dylib that can be loaded by either 32bit or
64bit
applications?

The only thing that comes to mind is two separate build trees, one 32bit
and the other 64bit and then somehow gluing the two libpqs together...

If the above is possible what happens when a 64 bit app tries to talk to
the 32 bit server?

If the previous question is true and I have the 64 bit libpq library
loaded
and then a 32 bit app talks to the server will the 32 bit libpq
library then
also be loaded in memory?

I guess I also need to try and build a dual architecture for dblink...

Am I confused?

Thanks for any input :)

Jerry

pgsql-general by date:

Previous
From: Björn Häuser
Date:
Subject: Re: SIGSEGV when trying to start in single user mode
Next
From: "Brendan Hill"
Date:
Subject: Re: Idle processes chewing up CPU?