如何在OSX上为iPhone构建openldap库?

| 我正在尝试为iOS3和4构建openldap-2.4.23库,但是当我尝试运行configure时出现错误:
>./configure --disable-slapd --disable-shared --enable-static --host=arm-apple-darwin

configure: WARNING: If you wanted to set the --build type, don\'t use --host.
If a cross compiler is detected then cross compile mode will be used.
Configuring OpenLDAP 2.4.23-Release ...
checking build system type... i686-apple-darwin10.7.0
checking host system type... arm-apple-darwin
checking target system type... arm-apple-darwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking configure arguments... configure: WARNING: slapd disabled, ignoring --enable- bdb argument
configure: WARNING: slapd disabled, ignoring --enable-hdb argument
configure: WARNING: slapd disabled, ignoring --enable-monitor argument
configure: WARNING: slapd disabled, ignoring --enable-relay argument
configure: WARNING: slapd disabled, ignoring --enable-syncprov argument
done
checking for style of include used by make... GNU
checking for arm-apple-darwin-gcc...     /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables
See `config.log\' for more details.
我的环境设置如下:
export DEVROOT=\"/Developer/Platforms/iPhoneOS.platform/Developer\"
export SDKROOT=\"/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk\"
export CC=\"${DEVROOT}/usr/bin/gcc\"
export LD=\"${DEVROOT}/usr/bin/ld\"
export AR=\"${DEVROOT}/usr/bin/ar\"
export AS=\"${DEVROOT}/usr/bin/as\"
export NM=\"${DEVROOT}/usr/bin/nm\"
export CPPFLAGS=\"-I${SDKROOT}/usr/lib/gcc/arm-apple-darwin10/4.2.1/include -I${SDKROOT}/usr/include\"
export CPP=\"${DEVROOT}/usr/bin/cpp ${CPPFLAGS}\"
export CFLAGS=\"${CPPFLAGS} -arch armv6 -pipe -no-cpp-precomp\"
export LDFLAGS=\"-L${SDKROOT}/usr/lib\"
顺便说一句,在修改CFLAGS和LDFALGS之后,我成功进行了配置,如下所示:
export CFLAGS=\"${CPPFLAGS} -pipe -no-cpp-precomp\"
export LDFLAGS=\"\"
但是,make&make install的结果不是armv体系结构:
> lipo -detailed_info libldap.a
input file libldap.a is not a fat file
Non-fat file: libldap.a is architecture: i386
如何建立armv6架构的openldap库? 任何人,请帮助! 谢谢。     
已邀请:
这可能对您来说有点晚,但是我使用Xcode将OpenLDAP移植到了iOS。可以从github克隆该项目。 https://github.com/bindle/iOSPorts 该项目中有一些文档和示例。     
我认为我离解决方案更近了一步(配置成功)。 我在这里发现了类似的问题,只是调整了构建脚本,以使其适用于ѭ4work。
#!/bin/bash

PLATFORMPATH=\"/Applications/Xcode.app/Contents/Developer/Platforms\"
TOOLSPATH=\"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin\"
export IPHONEOS_DEPLOYMENT_TARGET=\"8.0\"
pwd=`pwd`

findLatestSDKVersion()
{
    sdks=`ls $PLATFORMPATH/$1.platform/Developer/SDKs`
    arr=()
    for sdk in $sdks
    do
       arr[${#arr[@]}]=$sdk
    done

    # Last item will be the current SDK, since it is alpha ordered
    count=${#arr[@]}
    if [ $count -gt 0 ]; then
       sdk=${arr[$count-1]:${#1}}
       num=`expr ${#sdk}-4`
       SDKVERSION=${sdk:0:$num}
    else
       SDKVERSION=\"8.0\"
    fi
}

buildit()
{
    target=$1
    hosttarget=$1
    platform=$2

    echo =============================================================
    echo = building for target $target platform $platform ... =
    echo =============================================================

    if [[ $hosttarget == \"x86_64\" ]]; then
        hostarget=\"i386\"
    elif [[ $hosttarget == \"arm64\" ]]; then
        hosttarget=\"arm\"
    fi

    export CC=\"$(xcrun -sdk iphoneos -find clang)\"
    export CPP=\"$CC -E\"
    export CFLAGS=\"-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION\"
    export AR=$(xcrun -sdk iphoneos -find ar)
    export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
    export CPPFLAGS=\"-arch ${target}  -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION\"
    export LDFLAGS=\"-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk\"

    mkdir -p $pwd/output/$target

     ./configure --disable-shared --host=$hosttarget-apple-darwin --with-tls=openssl --disable-slapd --prefix=\"$pwd/output-build/common\"  --exec-prefix=\"$pwd/output-build/$target\"

    make depend
    # make clean
    make
    make install

    echo =============================================================
    echo = Success for target $target platform $platform ... =
    echo =============================================================
}

findLatestSDKVersion iPhoneOS

buildit armv7 iPhoneOS
buildit armv7s iPhoneOS
buildit arm64 iPhoneOS
buildit i386 iPhoneSimulator
buildit x86_64 iPhoneSimulator

#LIPO=$(xcrun -sdk iphoneos -find lipo)
#$LIPO -create $pwd/output/armv7/lib/libpresage.a  $pwd/output/armv7s/lib/libpresage.a $pwd/output/arm64/lib/libpresage.a $pwd/output/x86_64/lib/libpresage.a $pwd/output/i386/lib/libpresage.a -output libpresage.a
问题是报告了构建错误(执行
make
时):
Making all in /Users/maru/Documents/openldap-2c705e4/libraries
  Entering subdirectory liblutil
cc -g -O2 -I../../include        -I../../include     -arch x86_64  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -miphoneos-version-min=8.4  -c -o sasl.o sasl.c
sasl.c:26:10: fatal error: \'sasl/sasl.h\' file not found
#include <sasl/sasl.h>
         ^
1 error generated.
make[2]: *** [sasl.o] Error 1
make[1]: *** [all-common] Error 1
make: *** [all-common] Error 1
如果我正确理解了SASL的文档,则它不适用于iOS。因此,看来我比@alkain靠近了一步,但仍未找到最终解决方案。     

要回复问题请先登录注册