Re: More Snow Leopard fun: multiarch problems while building plperl - Mailing list pgsql-hackers

From Jan Otto
Subject Re: More Snow Leopard fun: multiarch problems while building plperl
Date
Msg-id 7DE9B2DD-5CD8-4E63-B5D7-CE04BA70413A@me.com
Whole thread Raw
In response to Re: More Snow Leopard fun: multiarch problems while building plperl  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: More Snow Leopard fun: multiarch problems while building plperl
Re: More Snow Leopard fun: multiarch problems while building plperl
List 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=`echoX"$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


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: RfD: more powerful "any" types
Next
From: Jan Otto
Date:
Subject: Re: More Snow Leopard fun: multiarch problems while building plperl