为iOS构建OpenLDAP客户端 - 没有SASL

时间:2015-10-13 15:47:02

标签: ios iphone xcode openldap sasl

由于Apple系统地弃用了OpenLDAPiOS的{​​{1}}(OS X已删除了所需的某些功能),我的团队决定{{3} ,构建它并将库包含到应用程序中。

我只需要客户端功能。

Build for MacOS不是问题:

10.10

这很顺利。

问题是为iOS构建。我发现很好latest OpenLDAP。我将这个bash脚本调整为~openLDAP`代码:

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

配置和#!/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在每个iOS目标上失败并出现此错误:

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 表单不适用于iOS,这是问题的根源。 我怎么能克服这个问题?我可以以不同方式配置SALS,以便使用其他内容吗?或者是否有适当的方式为iOS提供openLDAP

1 个答案:

答案 0 :(得分:0)

我不熟悉iOS / OSX,但要禁用Cyrus 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"

有关更多标记信息,请查看

./configure --help

this很好的参考。