Thread: DBD::Pg 2.10.7 compile failed on RH4

DBD::Pg 2.10.7 compile failed on RH4

From
Date:
Hello,
we have 32-bit PostgreSQL version 8.3.4 on 64-bit RHEL4 , Postgres
itself is working as expected.
We are using PostreSQL via following perl version
............................................
# perl -v
This is perl, v5.10.0 built for i686-linux-thread-multi
(with 4 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1004 [287188] provided by ActiveState
http://www.ActiveState.com
Built Sep  3 2008 11:22:08
............................................

Our problem is that DBD::Pg version 2.10.7 will not compile ,
/usr/bin/ld skips all libpq files as incompatible - please see a slice
of the result below :
............................................
rm -f blib/arch/auto/DBD/Pg/Pg.so
LD_RUN_PATH="/usr/lib" gcc  -shared -O2 Pg.o dbdimp.o quote.o types.o
-o blib/arch/auto/DBD/Pg/Pg.so   \
   -L/usr/lib -lpq -lm          \

/usr/bin/ld: skipping incompatible /usr/lib/libpq.so when searching for
-lpq
/usr/bin/ld: skipping incompatible /usr/lib/libpq.a when searching for
-lpq
/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libpq.so when searching
for -lpq
/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libpq.a when searching
for -lpq
/usr/bin/ld: skipping incompatible /usr/lib/libpq.so when searching for
-lpq
/usr/bin/ld: skipping incompatible /usr/lib/libpq.a when searching for
-lpq
/usr/bin/ld: cannot find -lpq
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/DBD/Pg/Pg.so] Error 1
............................................
libpq files available ( actually there seems to be only 1
file=/usr/lib/libpq.so.5.1 with 2 links to it ) are as below :
............................................
# find / -name libpq.so*
/usr/lib/libpq.so.5.1
/usr/lib/libpq.so
/usr/lib/libpq.so.5
# ll /usr/lib/libpq.so.5.1
-rwxr-xr-x  1 root root 122616 Sep 20 18:52 /usr/lib/libpq.so.5.1
# ll /usr/lib/libpq.so
lrwxrwxrwx  1 root root 12 Oct  6 14:06 /usr/lib/libpq.so ->
libpq.so.5.1
# ll /usr/lib/libpq.so.5
lrwxrwxrwx  1 root root 12 Oct  6 14:05 /usr/lib/libpq.so.5 ->
libpq.so.5.1

# file /usr/lib/libpq.so.5.1
/usr/lib/libpq.so.5.1: ELF 32-bit LSB shared object, Intel 80386,
version 1 (SYSV), stripped
#

............................................

I assume that something is mixed here (=32/64-bit) because linker claims
for incompatibility -  but because there is only 1 libpq created by
Postgres install, I'm a bit lost.
Should we use some other linker version ?

Any ideas how to proceed ?

Best Regards,
  Tapio



Re: DBD::Pg 2.10.7 compile failed on RH4

From
Tom Lane
Date:
<Tapio.Niva@tietoenator.com> writes:
> we have 32-bit PostgreSQL version 8.3.4 on 64-bit RHEL4 , Postgres
> itself is working as expected.
> ...
> Our problem is that DBD::Pg version 2.10.7 will not compile ,

> LD_RUN_PATH="/usr/lib" gcc  -shared -O2 Pg.o dbdimp.o quote.o types.o
> -o blib/arch/auto/DBD/Pg/Pg.so   \
>    -L/usr/lib -lpq -lm          \
> /usr/bin/ld: skipping incompatible /usr/lib/libpq.so when searching for
> -lpq

What it looks like to me is that you've got a 64-bit perl build ("file"
on the perl executable would be a good way to confirm that).  If so,
you're going to need a 64-bit version of libpq.so to link into it.

There's no reason a 64-bit libpq wouldn't interoperate with a 32-bit
server, so just installing the 64-bit postgresql-libs RPM alongside what
you have ought to be sufficient.

            regards, tom lane

Re: DBD::Pg 2.10.7 compile failed on RH4

From
Date:
Hello,
thanks for help, -m32 option to Makefile and make was successful, so was
also make test & make install.
Our own tests are connecting to postgres - at least so far.

Tom,we are using 32-bit perl & 32-bit postgres on 64-bit RHEL4, because
some of our sw still are 32-bit.
DBD::Pg is the latest version 2.10.7 from CPAN.

Again, thanks for great help !

Have a nice day

BR, Tapio

-----Original Message-----
From: Albe Laurenz [mailto:laurenz.albe@wien.gv.at]
Sent: 7. lokakuuta 2008 15:04
To: Niva Tapio; pgsql-general@postgresql.org
Subject: RE: [GENERAL] DBD::Pg 2.10.7 compile failed on RH4

Tapio.Niva wrote:
> we have 32-bit PostgreSQL version 8.3.4 on 64-bit RHEL4 , Postgres
> itself is working as expected.
> We are using PostreSQL via following perl version
> ............................................
> # perl -v
> This is perl, v5.10.0 built for i686-linux-thread-multi
> (with 4 registered patches, see perl -V for more detail)
> Copyright 1987-2007, Larry Wall
> Binary build 1004 [287188] provided by ActiveState
> http://www.ActiveState.com
> Built Sep  3 2008 11:22:08
> ............................................
>
> Our problem is that DBD::Pg version 2.10.7 will not compile ,
> /usr/bin/ld skips all libpq files as incompatible - please see a slice
> of the result below :
> ............................................
> rm -f blib/arch/auto/DBD/Pg/Pg.so
> LD_RUN_PATH="/usr/lib" gcc  -shared -O2 Pg.o dbdimp.o quote.o types.o
> -o blib/arch/auto/DBD/Pg/Pg.so   \
>    -L/usr/lib -lpq -lm          \
>
> /usr/bin/ld: skipping incompatible /usr/lib/libpq.so when searching
for
> -lpq

[...]
>
> # file /usr/lib/libpq.so.5.1
> /usr/lib/libpq.so.5.1: ELF 32-bit LSB shared object, Intel 80386,
> version 1 (SYSV), stripped
> #
>
> ............................................
>
> I assume that something is mixed here (=32/64-bit) because linker
claims
> for incompatibility -  but because there is only 1 libpq created by
> Postgres install, I'm a bit lost.
> Should we use some other linker version ?
>
> Any ideas how to proceed ?

Yes, the problem must be that the compiler produces 64-bit code
which cannot be linked with 32-bit code.

You can either install 64-bit PostgreSQL libraries or give
gcc the -m32 option so that it generates 32-bit code.

Yours,
Laurenz Albe

Re: DBD::Pg 2.10.7 compile failed on RH4

From
"Albe Laurenz"
Date:
Tapio.Niva wrote:
> we have 32-bit PostgreSQL version 8.3.4 on 64-bit RHEL4 , Postgres
> itself is working as expected.
> We are using PostreSQL via following perl version
> ............................................
> # perl -v
> This is perl, v5.10.0 built for i686-linux-thread-multi
> (with 4 registered patches, see perl -V for more detail)
> Copyright 1987-2007, Larry Wall
> Binary build 1004 [287188] provided by ActiveState
> http://www.ActiveState.com
> Built Sep  3 2008 11:22:08
> ............................................
>
> Our problem is that DBD::Pg version 2.10.7 will not compile ,
> /usr/bin/ld skips all libpq files as incompatible - please see a slice
> of the result below :
> ............................................
> rm -f blib/arch/auto/DBD/Pg/Pg.so
> LD_RUN_PATH="/usr/lib" gcc  -shared -O2 Pg.o dbdimp.o quote.o types.o
> -o blib/arch/auto/DBD/Pg/Pg.so   \
>    -L/usr/lib -lpq -lm          \
>
> /usr/bin/ld: skipping incompatible /usr/lib/libpq.so when searching for
> -lpq

[...]
>
> # file /usr/lib/libpq.so.5.1
> /usr/lib/libpq.so.5.1: ELF 32-bit LSB shared object, Intel 80386,
> version 1 (SYSV), stripped
> #
>
> ............................................
>
> I assume that something is mixed here (=32/64-bit) because linker claims
> for incompatibility -  but because there is only 1 libpq created by
> Postgres install, I'm a bit lost.
> Should we use some other linker version ?
>
> Any ideas how to proceed ?

Yes, the problem must be that the compiler produces 64-bit code
which cannot be linked with 32-bit code.

You can either install 64-bit PostgreSQL libraries or give
gcc the -m32 option so that it generates 32-bit code.

Yours,
Laurenz Albe