2015-10-13 54 views
0

由於蘋果系統自嘲OpenLDAPiOSOS X(這是需要的一些功能已經在10.10被刪除),我的團隊決定讓latest OpenLDAP,構建它,包括庫的應用程序。構建OpenLDAP客戶爲iOS - 沒有SASL

我只需要客戶端功能。

構建適用於MacOS不是問題:

$ ./configure --with-tls=openssl --disable-slapd \ 
> --prefix="`pwd`/openldap-build/common" \ 
> --exec-prefix="`pwd`/openldap-build/MacOS" 
$ make depend 
$ make 
$ make install 

此順利。

問題正在爲iOS而建立。我發現很好solution which allows to build such external libraries for iOS。我調整這個bash腳本一起去〜openLDAP`代碼:

#!/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 depend都OK。 make失敗與此錯誤每個iOS的目標:

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 

表我所看到的SALS不支持iOS,這是問題的根源。 我如何克服這個問題?我可以配置openLDAP的不同,所以它會使用別的東西嗎?或者有沒有一種體面的方式爲iOS提供SASL

回答

0

我不熟悉與iOS/OSX,但禁用賽勒斯SASL你可以嘗試

--without-cyrus-sasl 

除了你的其他./configure flags,即你需要運行

./configure --with-tls=openssl --disable-slapd \ 
--without-cyrus-sasl \ 
--prefix="`pwd`/openldap-build/common" \ 
--exec-prefix="`pwd`/openldap-build/MacOS" 

爲了進一步flags info check out

./configure --help 

and this nice re ference。