views:

623

answers:

5

Hello,

Hope someone can help me,

I am trying to build openldap for an app on my iPhoneOS3 but when I try to use something from the library I get this error :

Program received signal: “EXC_ BAD_ACCESS”.

I followed this website to compile openldap with iphone gcc. So I built openldap with this :

    export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
    export SDKROOT=$DEVROOT/SDKs/iPhoneOS3.0.sdk
    export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ 
-I$SDKROOT/usr/include/ -I/usr/local/BerkeleyDB.4.7/include/"
    export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
    export CPP="/usr/bin/cpp $CPPFLAGS"
    export LDFLAGS="-L$SDKROOT/usr/lib/ -L/usr/local/BerkeleyDB.4.7/lib/"

    ./configure CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.2.1 \
    LD=$DEVROOT/usr/bin/ld --host=arm-apple-darwin --with-yielding_select=yes
    make depend
    make

I copied libldap.a, liblber.a to my project and all headers as ldap.h ....

In project settings I have :

Header Search Path : /path/to/openldap/headers
Library Search Path : filled with path from libldap.a and liblber.a
Other Linker Flags : -lldap -llber -ObjC

Everything is fine when it builds but I get the error above with the following code :

LDAP **ld;

ldap_initialize(ld, "ldap://myldap.exemple.com");

Does someone have any idea what I can do ?

Thank you

A: 

same problem here

A: 

Yes, I made it work so I will try to help you.

Here the commands line that I used to set all flasgs.

export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS2.2.sdk

export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.0.1/include/ -I$SDKROOT/usr/include/ -I/usr/local/BerkeleyDB.4.7/include/"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
export CPP="/usr/bin/cpp $CPPFLAGS"

export LDFLAGS="-L$SDKROOT/usr/lib/ -L/usr/local/BerkeleyDB.4.7/lib/"

So I needed to build BerkeleyDB, my version is 4.7.25.

./configure CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 LD=$DEVROOT/usr/bin/ld --host=arm-apple-darwin
make 
make install

And finally I built openldap like this :

./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 --enable-dynamic=yes --enable-modules=no --enable-static=yes --disable-shared --enable-ldap=yes && make depend && make

May be you did the same, if not try those commands. I know I used gcc 4.0.1 instead of 4.2.1 the one of iPhone OS 3 but I was wedged cause when I was trying to build only a static library it wasn't working properly when I was building my project. (a lot of errors)

After I built openldap, I made a new project

add in Header Search Path with the openldap include in Project Settings.
I copied both library into the ressource folder of my project : libldap.a and liblber.a
I filled Other Linker Flags with "-ObjC -lldap -llber"

Hope that can help you.

Léon A
A: 

I gave up with us finally

Did you succeed ?
Léon A
Unfortuntely not. I managed to build the library following your instructions, but i still get the error. I have a more complete answer below. Thank you for all your help.
A: 

Hi Mark,

I think I made a mistake in my post, you should try to change

this line :

export LDFLAGS="-L$SDKROOT/usr/lib/ -L/usr/local/BerkeleyDB.4.7/include/"

by this one :

export LDFLAGS="-L$SDKROOT/usr/lib/ -L/usr/local/BerkeleyDB.4.7/lib/"

Sorry for my Mistake

Léon

Léon A
A: 

I gave up with us finally

Sorry I don't know why it doesn't work for you, I was testing rebuilding the library but it works for me.
Léon A
Thank you for the follow ups Léon. I realized my questions if anything were not helping anybody so I wanted to clean them from here but I couldn't so i edited my post w/ "I gave up with us finally". Thanks a lot for your time and help. Best of luck.