Собрать клиент OpenLDAP для iOS — без SASL

Поскольку Apple систематически отказывается от OpenLDAP для iOS и OS X (некоторые необходимые функции были удалены в 10.10), моя команда решила получить последняя версия OpenLDAP, соберите ее и включите библиотеки в приложение.

Мне нужен только клиентский функционал.

Сборка под MacOS не проблема:

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

Это проходит гладко.

Проблема в сборке под iOS. Я нашел хорошее решение, которое позволяет создавать такие внешние библиотеки для 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 в порядке. 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 по-другому, чтобы он использовал что-то другое? Или есть достойный способ предоставить SASL для iOS?


person Marek R    schedule 13.10.2015    source источник


Ответы (1)


Я не знаком с 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

и эту хорошую ссылку.

person Asalle    schedule 04.03.2016