Thread: Error using Perl interface

Error using Perl interface

From
"Mengelbier, Magnus"
Date:
Hello

We wonder if anyone has found and resolved an error we recieve when trying
to connect to a PostgreSQl 6.5.1 database with perl 5.0053.

First, the perl script...

#! /usr/bin/perl

use Pg;

$conn = Pg::connectdb("dbname=template1");
$result = $conn -> exec("create database pgtest");

When we run this we get the following error message.

Can't load '/usr/lib/perl5/site_perl/i386-linux/auto/Pg/Pg.so' for module
Pg: /usr/lib/perl5/site_perl/i386-linux/auto/Pg/Pg.so: undefined symbol:
Perl_markstack_ptr at /usr/lib/perl5/5.0053/i386-linux/DynLoader.pm at line
169.

at ./test.pl line 3         (which is use Pg;)

We are running Red Hat 6.0 standard installation with PostgreSQL 6.5.1 and
the perl interface that was available. We opted to install the binaries
instead of compiliing the source ourselves.  We are running Perl 5.0053 that
was installed with the system installation.

Thanks 

Magnus


Re: [INTERFACES] Error using Perl interface

From
Tom Lane
Date:
"Mengelbier, Magnus" <Magnus.Mengelbier@clinicaldatacare.com> writes:
> We wonder if anyone has found and resolved an error we recieve when trying
> to connect to a PostgreSQl 6.5.1 database with perl 5.0053.
> We are running Red Hat 6.0 standard installation with PostgreSQL 6.5.1 and
> the perl interface that was available. We opted to install the binaries
> instead of compiliing the source ourselves.  We are running Perl 5.0053 that
> was installed with the system installation.

I believe we found out recently that Perl 5.005-something changed its PM
interfaces, thereby breaking the Postgres perl5 module at both source
and binary levels.  If you revert to Perl 5.004-anything it should work.

It would be nice to find a Perl guru who knows how to fix the perl5
module for the new Perl *without* breaking backwards compatibility for
older Perls (source-level compatibility that is, I suppose binary
compatibility is hopeless).
        regards, tom lane


Re: [INTERFACES] Error using Perl interface

From
Thomas Lockhart
Date:
> We wonder if anyone has found and resolved an error we recieve when trying
> to connect to a PostgreSQl 6.5.1 database with perl 5.0053.
...
> We are running Red Hat 6.0 standard installation with PostgreSQL 6.5.1 and
> the perl interface that was available. We opted to install the binaries
> instead of compiliing the source ourselves.  We are running Perl 5.0053 that
> was installed with the system installation.

Which "binaries" did you install, and from what source? RedHat
currently uses a cheat to install perl (and a few other kinds of
things) in that they stuff *all* generated code into the "version
neutral" perl library area. So something built for perl-5.004x, as
were rpms posted at postgresql.org, will have been built and linked
for that version, but perl doesn't know that.

Anyway, I'm guessing that if you pick up the src.rpm for Postgres, and
build it on your system, it will start working.

I'm sure that there is a better way, like
 rpm --rebuild postgresql-6.5.1-src.rpm

but I haven't actually tried running that way since I've been building
the rpms. I do know that something like
 rpm -ivv postgresql-6.5.1-src.rpm cd /usr/src/redhat/SPECS rpm -ba postgresql-6.5.1.spec cd ../RPMS/i386

will get you new rpms for your platform, built against your tools.

Good luck.
                     - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


Re: [INTERFACES] Error using Perl interface

From
Lamar Owen
Date:
Thomas Lockhart wrote:
>   rpm --rebuild postgresql-6.5.1-src.rpm
> 
> but I haven't actually tried running that way since I've been building
> the rpms. I do know that something like

As a clean room experiment, I have rebuilt both Thomas' and my RPMS with
the --rebuild directive on clean RedHat 6 installations -- the only
caveat is that you must install python-devel, which is not by default
installed with the other development libraries.  The command line Thomas
gave is correct.

Thomas, when you get back from your vacation we need to talk about the
relative advantages and disadvantages of the current perl install
technique, and brainstorm over possible alternatives.

In my rpms (at http://www.ramifordistat.net/postgres) , I have packaged
the perl client test script, test.pl.  This script will give your perl
client a real workout.  The test.pl script is in the perl subpackage, I
think.... I am going to have to start using rpm2html to document them
things... 

Lamar Owen
WGCR Internet Radio