views:

23

answers:

1

I'm building a universal binary for OS X. I'm doing this through QT which calls ld.

ld throws an error when building for the ppc architecture:

in ../MyPathToLib/libcrypto.a, file is universal but not does contain a(n) ppc slice for architecture ppc

This is really strange, because when I call lipo -detailed info on libcrypto.a, I get the following output:

lipo libcrypto.a -detailed_info
Fat header in: libcrypto.a
fat_magic 0xcafebabe
nfat_arch 3
architecture ppc
    cputype CPU_TYPE_POWERPC
    cpusubtype CPU_SUBTYPE_POWERPC_ALL
    offset 68
    size 246
    align 2^0 (1)
architecture x86_64
    cputype CPU_TYPE_X86_64
    cpusubtype CPU_SUBTYPE_X86_64_ALL
    offset 316
    size 3251896
    align 2^2 (4)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 3252212
    size 2556576
    align 2^2 (4)

The weird thing about it is that if I build with arch x86, everything builds fine. I see right there with lipo that i386 and ppc are both there, but apparently it only likes i386. I built that libcrypto.a library myself by building OpenSSL three times and stitching them together with lipo.

Does anyone have any idea how it could be universal, have a ppc section, but not contain a ppc slice (whatever that is)?

+2  A: 

I guess you didn't correctly create the universal libcrypto.a. The output of lipo says that the size of the ppc slice is just 246 bytes, while the i386/x86_64 slices have 2~3 mega bytes each. I guess the ppc version of libcrypto.a which you fed to lipo was defective.

Yuji
Great catch, I must have made some sort of typo the first I was lipo'ing them together and lipo'd in the wrong file. Thanks for your help.
Nantucket