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

Building plperl in CVS HEAD, the link step looks like this:

gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-fno-strict-aliasing-fwrapv -g  -bundle -multiply_defined suppress  plperl.o spi_internal.o SPI.o -bundle_loader
../../../src/backend/postgres-L/usr/local/lib -L/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE
-L../../../src/port-arch x86_64 -arch i386 -arch ppc -lperl -ldl -lm -lutil -lc  -o plperl.so
 

and complains like this:

ld: warning: in ../../../src/backend/postgres, file is not of required architecture
ld: warning: in plperl.o, file is not of required architecture
ld: warning: in spi_internal.o, file is not of required architecture
ld: warning: in SPI.o, file is not of required architecture
ld: warning: in ../../../src/backend/postgres, file is not of required architecture
ld: warning: in plperl.o, file is not of required architecture
ld: warning: in spi_internal.o, file is not of required architecture
ld: warning: in SPI.o, file is not of required architecture

libperl.so, like much of the rest of the system, seems to be a
3-architecture universal binary:

$ file /System/Library/Perl/lib/5.10/libperl.dylib
/System/Library/Perl/lib/5.10/libperl.dylib: Mach-O universal binary with 3 architectures
/System/Library/Perl/lib/5.10/libperl.dylib (for architecture x86_64):  Mach-O 64-bit dynamically linked shared library
x86_64
/System/Library/Perl/lib/5.10/libperl.dylib (for architecture i386):    Mach-O dynamically linked shared library i386
/System/Library/Perl/lib/5.10/libperl.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc

which I found rather surprising because I thought Snow Leopard had
yanked out all support for PPC.  However, there it is.  But you do *not*
get 3-arch binaries out of gcc by default, and thus the warnings.
The reason the linker is complaining is that it was asked to produce
a 3-arch binary by the "-arch x86_64 -arch i386 -arch ppc" switches.
It did:

$ file plperl.so
plperl.so: Mach-O universal binary with 3 architectures
plperl.so (for architecture x86_64):    Mach-O 64-bit bundle x86_64
plperl.so (for architecture i386):      Mach-O bundle i386
plperl.so (for architecture ppc):       Mach-O bundle ppc

but I'll bet a lot of money the other two arches don't actually work.

Anyway, the long and the short of it is that we are extracting this
value for perl_embed_ldflags:

perl_embed_ldflags      =  -arch x86_64 -arch i386 -arch ppc -L/usr/local/lib
-L/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE-lperl -ldl -lm -lutil -lc
 

and it seems to me that it's a pretty bad idea to have this switch
collection trying to override the arch(es) that Postgres is actually
being built for.  Does anyone have an opinion about that pro or con?
Anybody have an idea about a simple way to get rid of those switches?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: LATERAL
Next
From: Pavel Stehule
Date:
Subject: Re: manually setting the command tag (was Re: 8.4: suppress_redundant_updates trigger vs. "Upsert" logic)