Как собрать библиотеку openldap для iphone на OSX? - PullRequest
3 голосов
/ 13 апреля 2011

Я пытаюсь собрать библиотеку openldap-2.4.23 для iOS3 и 4, но когда я пытаюсь запустить 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.

Мои настройки env такие:

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

Как собрать библиотеку openldap для архитектуры armv6? Кто-нибудь, пожалуйста, помогите !!

Спасибо.

Ответы [ 2 ]

0 голосов
/ 13 октября 2015

Я думаю, что я на шаг ближе к решению (конфигурация прошла успешно).Я обнаружил подобную проблему здесь и просто настроил скрипт сборки, чтобы он работал на 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):

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, но все еще не нашел окончательного решения.

0 голосов
/ 20 октября 2011

Это может быть немного поздно для вас, однако я перенес OpenLDAP на iOS, используя Xcode.Проект можно клонировать из github.https://github.com/bindle/iOSPorts

В проекте имеется некоторая документация и примеры.

...