Re: More Snow Leopard fun: multiarch problems while building plperl

From: Jan Otto <asche(at)me(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: More Snow Leopard fun: multiarch problems while building plperl
Date: 2009-09-08 17:56:22
Message-ID: 7DE9B2DD-5CD8-4E63-B5D7-CE04BA70413A@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi tom,

>> perl_embed_ldflags is currently the difference of
>> perl -MExtUtils::Embed -e ldopts
>> minus
>> perl -MConfig -e 'print $Config{ccdlflags}'
>> In that spirit, the answer would be to find something else in
>> ExtUtils
>> or Config that we can remove from ldopts.
>
> As far as I can tell, there is nothing in Config that exposes just the
> -arch switches without any other stuff. I'm inclined to go with Jan
> Otto's solution of sed'ing out those switches by name. It's a bit
> ugly
> but should be safe.

Yes it is really ugly.

The problem here is that ARCHFLAGS is not set. If it is set correctly
the ldopts would be correctly set:

$ export ARCHFLAGS="-arch x86_64"
$ perl -MExtUtils::Embed -e ldopts
-arch x86_64 -L/usr/local/lib -L/System/Library/Perl/5.10.0/darwin-
thread-multi-2level/CORE -lperl -ldl -lm -lutil -lc
$

if ARCHFLAGS is not set Config_heavy.pl puts '-arch x86_64 -arch i386 -
arch ppc' in by default:

$ unset ARCHFLAGS
$ perl -MExtUtils::Embed -e ldopts
-L/usr/local/lib -L/System/Library/Perl/5.10.0/darwin-thread-
multi-2level/CORE -lperl -ldl -lm -lutil -lc
$

more elegant would be something like this instead of 'perl -
MExtUtils::Embed -e ldopts'

[ "$ARCHFLAGS" ] || export ARCHFLAGS=""; perl -MExtUtils::Embed -e
ldopts

example:
$ export ARCHFLAGS="-arch x86_64"
$ [ "$ARCHFLAGS" ] || export ARCHFLAGS=""; perl -MExtUtils::Embed -e
ldopts
-arch x86_64 -L/usr/local/lib -L/System/Library/Perl/5.10.0/darwin-
thread-multi-2level/CORE -lperl -ldl -lm -lutil -lc
$ unset ARCHFLAGS
$ [ "$ARCHFLAGS" ] || export ARCHFLAGS=""; perl -MExtUtils::Embed -e
ldopts
-L/usr/local/lib -L/System/Library/Perl/5.10.0/darwin-thread-
multi-2level/CORE -lperl -ldl -lm -lutil -lc
$

so we make shure if somebody tries to build an universal binary of
postgres by setting the correct ARCHFLAGS
the configure works too.

patch against HEAD:

diff -c -r1.653 configure
*** configure 26 Aug 2009 22:24:41 -0000 1.653
--- configure 8 Sep 2009 17:47:29 -0000
***************
*** 6941,6947 ****

{ $as_echo "$as_me:$LINENO: checking for flags to link embedded
Perl" >&5
$as_echo_n "checking for flags to link embedded Perl... " >&6; }
! pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed "s/^X//;s%$pgac_tmp2%%"`
if test -z "$perl_embed_ldflags" ; then
--- 6941,6947 ----

{ $as_echo "$as_me:$LINENO: checking for flags to link embedded
Perl" >&5
$as_echo_n "checking for flags to link embedded Perl... " >&6; }
! pgac_tmp1=`[ "$ARCHFLAGS" ] || export ARCHFLAGS=""; $PERL -
MExtUtils::Embed -e ldopts`
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed "s/^X//;s%$pgac_tmp2%%"`
if test -z "$perl_embed_ldflags" ; then

regards, jan otto

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Otto 2009-09-08 18:00:21 Re: More Snow Leopard fun: multiarch problems while building plperl
Previous Message David Fetter 2009-09-08 17:48:01 Re: RfD: more powerful "any" types