Compiler options for plperl

Lists: pgsql-patches
From: Reinhard Max <max(at)suse(dot)de>
To: pgsql-patches(at)postgresql(dot)org
Subject: Compiler options for plperl
Date: 2002-10-31 15:47:46
Message-ID: Pine.LNX.4.44.0210311629330.14190-200000@wotan.suse.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Hi,

applications that use Perl as embedded interpreter should be compiled
with the same compiler flags that were used to compile the perl shared
library itself. The attached patch fixes this.

cu
Reinhard

Attachment Content-Type Size
postgresql-plperl.patch text/plain 1.0 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reinhard Max <max(at)suse(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Compiler options for plperl
Date: 2002-10-31 17:11:46
Message-ID: 7819.1036084306@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Reinhard Max <max(at)suse(dot)de> writes:
> applications that use Perl as embedded interpreter should be compiled
> with the same compiler flags that were used to compile the perl shared
> library itself. The attached patch fixes this.

Unfortunately, this goes down the same dead-end path we went down three
or four releases ago. If we try to do the above then we must also use
the same compiler that was used for Perl. For example, your patch will
instantly blow up on my system where Perl is built with HPUX's cc (per
its default configuration) and Postgres is built with gcc (also its
default choice) --- the compiler switches aren't even slightly alike.

Please explain the problem you're trying to solve, rather than offering
an unworkable patch with no explanation.

regards, tom lane


From: Reinhard Max <max(at)suse(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Compiler options for plperl
Date: 2002-10-31 17:53:52
Message-ID: Pine.LNX.4.44.0210311814510.9561-100000@wotan.suse.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, 31 Oct 2002 at 12:11, Tom Lane wrote:

> If we try to do the above then we must also use the same compiler
> that was used for Perl. For example, your patch will instantly blow
> up on my system where Perl is built with HPUX's cc (per its default
> configuration) and Postgres is built with gcc (also its default
> choice) --- the compiler switches aren't even slightly alike.

I see.

Would it work for you, if only the preprocessor macro definitions were
derived from perl?

Here I get:

$ perl -MConfig -e 'print $Config{ccflags}'
-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64

> Please explain the problem you're trying to solve, rather than
> offering an unworkable patch with no explanation.

While I tried to compile PostgreSQL-7.3b3, I got:

gcc -O2 -g -fPIC -I.
-I/usr/lib/perl5/5.8.0/x86_64-linux-thread-multi/CORE
-I../../../src/include -c -o plperl.o plperl.c
In file included from
/usr/lib/perl5/5.8.0/x86_64-linux-thread-multi/CORE/op.h:480,
from
/usr/lib/perl5/5.8.0/x86_64-linux-thread-multi/CORE/perl.h:2209,
from plperl.c:61:
/usr/lib/perl5/5.8.0/x86_64-linux-thread-multi/CORE/reentr.h:602:
field `_crypt_struct' has incomplete type
/usr/lib/perl5/5.8.0/x86_64-linux-thread-multi/CORE/reentr.h:747:
confused by earlier errors, bailing out
make[3]: *** [plperl.o] Error 1

Adding -D_GNU_SOURCE to the gcc command line fixed this (crypt.h only
declares "struct crypt_data" when _GNU_SOURCE is defined). Our Perl
maintainer told me then, that these definitions should always be
fetched from Perl itself to be on the safe side.

cu
Reinhard


From: Neil Conway <neilc(at)samurai(dot)com>
To: Reinhard Max <max(at)suse(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Compiler options for plperl
Date: 2002-11-04 23:04:07
Message-ID: 873cqh3pjs.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Reinhard Max <max(at)suse(dot)de> writes:
> Would it work for you, if only the preprocessor macro definitions were
> derived from perl?

I guess that's reasonable -- at least it should solve the Perl 5.8.0
problems, which is the only thing requiring immediate attention.

Provided no one else objects, can you send in a patch for this? IMHO
we should have a fix for the Perl problems in 7.3, in one form or
another.

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC


From: Reinhard Max <max(at)suse(dot)de>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Compiler options for plperl
Date: 2002-11-05 09:46:53
Message-ID: Pine.LNX.4.44.0211051045070.16317-200000@wotan.suse.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Hi,

On 4 Nov 2002 at 18:04, Neil Conway wrote:

> Provided no one else objects, can you send in a patch for this? IMHO
> we should have a fix for the Perl problems in 7.3, in one form or
> another.

here it comes...

cu
Reinhard

Attachment Content-Type Size
postgresql-plperl.patch text/plain 1.6 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Reinhard Max <max(at)suse(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Compiler options for plperl
Date: 2002-11-05 22:41:28
Message-ID: Pine.LNX.4.44.0211051919070.1815-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Reinhard Max writes:

> Would it work for you, if only the preprocessor macro definitions were
> derived from perl?

Nope. I don't want to trust anything that comes from Perl.

Why not just define _GNU_SOURCE in some strategic place? (But please not
on the command line.)

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Reinhard Max <max(at)suse(dot)de>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Compiler options for plperl
Date: 2002-11-06 08:27:52
Message-ID: Pine.LNX.4.44.0211060914590.29657-100000@wotan.suse.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Tue, 5 Nov 2002 at 23:41, Peter Eisentraut wrote:

> Reinhard Max writes:
>
> > Would it work for you, if only the preprocessor macro definitions were
> > derived from perl?
>
> Nope. I don't want to trust anything that comes from Perl.

Me neither, but I think there is no other chance.

> Why not just define _GNU_SOURCE in some strategic place? (But
> please not on the command line.)

As far as I understood our Perl guy, anything that embeds Perl _has_
to (or at least _should_) be compiled with the same preprocessor
defines. It might depend on the platform and compile-time
configuration of Perl which defines are needed for a particular
installation.

So why not let Perl itself tell what switches it needs?

cu
Reinhard