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

如何在OSX上为iphone构建openldap库?,iphone,ios,macos,openldap,armv6,Iphone,Ios,Macos,Openldap,Armv6,我正在尝试为iOS3和IOS4构建openldap-2.4.23库,但当我尝试运行配置时,出现错误: >./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

我正在尝试为iOS3和IOS4构建openldap-2.4.23库,但当我尝试运行配置时,出现错误:

>./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和LDFALG修改如下后,我成功地进行了配置:

export CFLAGS="${CPPFLAGS} -pipe -no-cpp-precomp"
export LDFLAGS=""
但是,make&make安装的结果不是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克隆


项目中有一些文档和示例。

我认为我离解决方案更近了一步(it配置成功)。 我已经找到并简单地调整了构建脚本,使其能够在
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
时):

在/Users/maru/Documents/openldap-2c705e4/libraries中创建所有
进入子目录liblutil
cc-g-O2-I..//包括-I..//包括-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:致命错误:“未找到sasl/sasl.h”文件
#包括
^
生成1个错误。
生成[2]:***[sasl.o]错误1
生成[1]:***[all common]错误1
make:**[所有常见]错误1

如果我正确理解SASL的文档,它将不适用于iOS。看来我比@alkain更接近了一步,但仍然没有找到最终的解决方案。

你是在Mac OS X Lion上编译的,不是吗?
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