Adding a static library to an iPhone project

Discussion in 'iPhone/iPad Programming' started by stjohnbee, Apr 20, 2009.

  1. macrumors newbie

    Joined:
    Mar 25, 2009
    #1
    Hi guys,

    The motivation for this question is me trying to get LDAP functions to work with an iPhone application which is a project I'm attempting for part of my dissertation.

    When I was developing the application I used the ldap.framework framework that is part of Mac OS X. This works fine in the simulator, but when I try to now get the app on a device it tells me that I'm not allowed to use this framework.

    After some research I found that I could build openldap using the arm architecture and add the static library to my application destined for my device.

    I eventually managed to compile configure and build openldap by setting variables as mentioned here and using the following commands...

    Code:
    Ade$ ./configure CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 \
    LD=$DEVROOT/usr/bin/ld --host=arm-apple-darwin --with-yielding_select=yes
    Ade$ make depend
    Ade$ make
    I was told that the file I'm looking for will have an extension of '.a' so I searched for a '.a' file that mentions ldap...

    Code:
    Ade$ sudo find / -name *ldap*.a
    Password:
    /Users/Ade/Desktop/openldap-2.4.16/libraries/libldap/.libs/libldap.a
    /Users/Ade/Desktop/openldap-2.4.16/libraries/libldap_r/.libs/libldap_r.a
    So I assume these are the files I need?

    My question is what do I do next? I know I need to add the library to the Xcode project and probably add a load of '.h' files too?

    If anyone can give me a pointer to documentation or shed any light on the next stage I would be really grateful.

    I know this subject has been talked about before, but I can't seem to find a definite answer to this specific problem.

    Many thanks, Ade

    ps. I have also talked about this process on my blog at www.greenpasta.com.
     

Share This Page