views:

96

answers:

1

Hi there,

I tried to use openLdap for my iphone app I'm developing at the moment. To compile openLdap I'm using the fat_build.sh from link text. I'm also developing with the Simulator 3.1.3 and under OS X 10.6.0. But at the last step

$DEVROOT/usr/bin/lipo -arch arm lnsout/$LIBLDAP_NAME_static.arm -arch i386 lnsout/$LIBLDAP_NAME_static.i386 -create -output lnsout/$LIBLDAP_NAME_static
$DEVROOT/usr/bin/lipo -arch arm lnsout/$LIBLBER_NAME_static.arm -arch i386 lnsout/$LIBLBER_NAME_static.i386 -create -output lnsout/$LIBLBER_NAME_static

I get following error:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: specifed architecture type (arm) for file (lnsout/libldap.a.arm) does not match it's cputype (7) and cpusubtype (3) (should be cputype (12) and cpusubtype (0))
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: specifed architecture type (arm) for file (lnsout/liblber.a.arm) does not match it's cputype (7) and cpusubtype (3) (should be cputype (12) and cpusubtype (0))

I tried to fix it by setting the Header Search Path, Library Search Path and the Linker Flags without result.

So if you have any ideas how I could solve this problem, please let me know !

A: 

I got a similar error when I was building libssh2 for iPhone, and after a lot of searching, I came to the realization that my .arm build had actually been built for i386 (my MacBook Pro).

I went so far as to compile libssh2 for ARMv6 (device), i386 (computer), and x86_64 (simulator), just to make sure each version built correctly. I then combined the arm and x86_64 architectures using lipo. I have a starred comment in my notes that "'make clean' and 'make distclean' are your friends," so perhaps if you built the library for your machine first, it still had the config file for that when you built for the iPhone.

I used the commands "lipo -info libldap.a.arm" and "file libldap.a.arm" (modified for your filenames) to see further info on the build type. FYI, once they built correctly, those commands showed the architectures "arm" and "x86_64."

One last thing I noticed--the code in the above github link actually contains pre-compiled universal binaries for libldap.a and liblber.a. After messing around building the libraries, I noticed that and just used those two files with the ldap.h file, and I was good to go.

Bill Weakley