Hello!
Am 07.04.2006 um 13:50 schrieb User Roman:
# philipp.ott@xxxxxxxxx / 2006-03-31 10:05:06 +0200:
I would like to know if somebody already has a Mac OSX Intel 10.4.5
pg-Library (for C, C++, Objective C) or knows how to compile it?
What problems did you have building libpq?
Note: I'm not an OSX user.
I just wanted to know - I would like to have universal binaries of
libpg and psql to deploy.
Currently 8.1.3 compiles and runs just fine on OSX 10.4.6 + XCode
2.2.1, but generates binaries just for the current host architecture.
Now when I add -arch i386 -arch ppc to CFLAGS and LDFLAGS for
configure, then it compiles everything just fine, however at linking
stage I get various problems for missing architecture files. Every
generated .o file in the src build tree is actually an universal
binary now, like for example
./src/timezone/SUBSYS.o:
Mach header
magic cputype cpusubtype filetype ncmds sizeofcmds flags
0xfeedface 7 3 1 4 852 0x00002000
Fat headers
fat_magic 0xcafebabe
nfat_arch 2
architecture 0
cputype 7
cpusubtype 3
offset 64
size 48100
align 2^5 (32)
architecture 1
cputype 18
cpusubtype 0
offset 48192
size 69332
align 2^5 (32)
./src/timezone/zic.o:
Mach header
magic cputype cpusubtype filetype ncmds sizeofcmds flags
0xfeedface 7 3 1 3 772 0x00002000
So when make comes to the first linking this happens:
gcc -no-cpp-precomp -arch i386 -arch ppc -Wall -Wmissing-prototypes -
Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -
fno-strict-aliasing -L../../src/port -arch i386 -arch ppc access/
SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o parser/SUBSYS.o commands/
SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o
nodes/SUBSYS.o optimizer/SUBSYS.o port/SUBSYS.o postmaster/SUBSYS.o
regex/SUBSYS.o rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o utils/
SUBSYS.o ../../src/timezone/SUBSYS.o ../../src/port/
libpgport_srv.a -lz -lreadline -lresolv -ldl -lm -o postgres
/usr/bin/ld: for architecture ppc
/usr/bin/ld: warning access/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning bootstrap/SUBSYS.o cputype (7, architecture
i386) does not match cputype (18) for specified -arch flag: ppc (file
not loaded)
/usr/bin/ld: warning catalog/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning parser/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning commands/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning executor/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning lib/SUBSYS.o cputype (7, architecture i386) does
not match cputype (18) for specified -arch flag: ppc (file not loaded)
/usr/bin/ld: warning libpq/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning main/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning nodes/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning optimizer/SUBSYS.o cputype (7, architecture
i386) does not match cputype (18) for specified -arch flag: ppc (file
not loaded)
/usr/bin/ld: warning port/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning postmaster/SUBSYS.o cputype (7, architecture
i386) does not match cputype (18) for specified -arch flag: ppc (file
not loaded)
/usr/bin/ld: warning regex/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning rewrite/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning storage/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning tcop/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning utils/SUBSYS.o cputype (7, architecture i386)
does not match cputype (18) for specified -arch flag: ppc (file not
loaded)
/usr/bin/ld: warning ../../src/timezone/SUBSYS.o cputype (7,
architecture i386) does not match cputype (18) for specified -arch
flag: ppc (file not loaded)
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//cc0yANLg.out (No such file or
directory)
make[2]: *** [postgres] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2
However all the mentioned .o files in this linking list above are
both architecture 7 and 18.
Did someone else encounter similar problems and could fix this and
let me know please?
I used
configure CFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"
for the initial configure run.
Thank you
Philipp