pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL 8.1 x86_64 and 32bit shared objects
4+ messages / 2 participants
[nested] [flat]

* PostgreSQL 8.1 x86_64 and 32bit shared objects
@ 2006-02-07 18:20  CG <cgg007@yahoo.com>
  0 siblings, 1 reply; 4+ messages in thread

From: CG @ 2006-02-07 18:20 UTC (permalink / raw)
  To: pgsql-admin

Let me preface this by disclosing that I'm a novice when it comes to 64bit
computing, so please be kind. :)

I've wrapped a 32bit closed-source .so library in a C program which exposes
it's functionality to PostgreSQL. Compiling the wrapper with gcc64 fails, but
compiling the wrapper with gcc32 seems to work fine. PostgreSQL, which was
built using the 64bit compiler, won't allow me to reference the library when I
create the function:

data=# CREATE OR REPLACE FUNCTION getvalue(text,text)
data-# returns text
data-#  as '$libdir/wrapper'
data-# language 'C';
ERROR:  could not load library "/usr/local/pgsql-8.1.2/lib/wrapper.so":
/usr/local/pgsql-8.1.2/lib/wrapper.so: cannot open shared object file: No such
file or directory
data=#

Of course, wrapper.so is in the correct spot. 

Being the novice that I am, I thought that 32bit and 64bit binary code could be
used interchangeably. Is there some incompatibility of which I am unaware? Is
there perhaps some type of compatibility flag that I should be using, or a
wrapper for my wrapper? It is important that the overall operation of
PostgreSQL is as fast and as powerful as possible. While the functionality in
the library that I want to use from PostgreSQL is important, it is not
mission-critical. 

Please advise! Thanks!

CG

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL 8.1 x86_64 and 32bit shared objects
@ 2006-02-07 18:38  Tom Lane <tgl@sss.pgh.pa.us>
  parent: CG <cgg007@yahoo.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2006-02-07 18:38 UTC (permalink / raw)
  To: cgg007@yahoo.com; +Cc: pgsql-admin

CG <cgg007@yahoo.com> writes:
> Being the novice that I am, I thought that 32bit and 64bit binary code
> could be used interchangeably. Is there some incompatibility of which
> I am unaware?

AFAIK you can't mix the two in the same executable image.  If you are
stuck using a 32-bit-only library, you'll have to build all of the
Postgres server as 32-bit.  Note that this is probably not going to
cost all that much performance-wise, so I wouldn't recommend expending
any great amount of sweat to avoid it.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL 8.1 x86_64 and 32bit shared objects
@ 2006-02-07 20:02  CG <cgg007@yahoo.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: CG @ 2006-02-07 20:02 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-admin



--- Tom Lane <tgl@sss.pgh.pa.us> wrote:

> CG <cgg007@yahoo.com> writes:
> > Being the novice that I am, I thought that 32bit and 64bit binary code
> > could be used interchangeably. Is there some incompatibility of which
> > I am unaware?
> 
> AFAIK you can't mix the two in the same executable image.  If you are
> stuck using a 32-bit-only library, you'll have to build all of the
> Postgres server as 32-bit.  Note that this is probably not going to
> cost all that much performance-wise, so I wouldn't recommend expending
> any great amount of sweat to avoid it.

Hm. It looks like building 32-bit Postgres is going to be even uglier what with
all the libraries that will have to be compiled into lib32. It thought it would
be easy enough to CC=gcc32 ./configure --with-all-my-options ... Should I have
started out with a 32-bit Linux distro?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL 8.1 x86_64 and 32bit shared objects
@ 2006-02-07 20:11  Tom Lane <tgl@sss.pgh.pa.us>
  parent: CG <cgg007@yahoo.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2006-02-07 20:11 UTC (permalink / raw)
  To: cgg007@yahoo.com; +Cc: pgsql-admin

CG <cgg007@yahoo.com> writes:
> Hm. It looks like building 32-bit Postgres is going to be even uglier
> what with all the libraries that will have to be compiled into
> lib32. It thought it would be easy enough to CC=gcc32 ./configure
> --with-all-my-options ... Should I have started out with a 32-bit
> Linux distro?

Not sure what other distros are doing, but at least for Red Hat you
should be able to get 32-bit versions of all the libraries in the
standard distro, and even install them in parallel with 64-bit.

Also, you probably want to use setarch rather than fooling piecemeal
with CC etc.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-02-07 20:11 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-07 18:20 PostgreSQL 8.1 x86_64 and 32bit shared objects CG <cgg007@yahoo.com>
2006-02-07 18:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-02-07 20:02   ` CG <cgg007@yahoo.com>
2006-02-07 20:11     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox