繁体   English   中英

我需要什么工具链来交叉编译Clang for iOS

[英]What toolchain do I need to cross-compile Clang for iOS

好的,首先我知道这可以在iOS(armv7)上编译,因为我阅读了文档。 但是,我找不到合适的工具链。

那么,现在,我已经尝试过哪些工具链:

i686-apple-darwin10-cpp-4.2.1
i686-apple-darwin10-g++-4.2.1
i686-apple-darwin10-gcc-4.2.1

以上交叉编译为x86(我在i386上)。 工作正常。 但我不需要它

arm-apple-darwin10-cpp-4.2.1
arm-apple-darwin10-g++-4.2.1
arm-apple-darwin10-gcc-4.2.1

以上编译很好,但不会像我预期的那样交叉编译到arm,相反,它只是编译到我当前的arch。

我是这个问题的真正初学者,事实上这是我第一次尝试交叉编译。

更新:

以下是我尝试过的命令(这是针对armv6; armv7类似):

配置:

../llvm/configure --host=arm-apple-darwin6 --target=arm-apple-darwin6 
--build=i386-apple-darwin --enable-optimized --disable-debug  
--disable-expensive-checks --disable-doxygen  --disable-threads

env vars:

    export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk

export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"

    export CPP="$DEVROOT/usr/bin/arm-apple-darwin10-cpp-4.2.1"
export CXX="$DEVROOT/usr/bin/arm-apple-darwin10-g++-4.2.1"
export CXXCPP="$DEVROOT/usr/bin/arm-apple-darwin10-cpp-4.2.1"
export CC="$DEVROOT/usr/bin/arm-apple-darwin10-gcc-4.2.1"
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 RANLIB=$DEVROOT/usr/bin/ranlib
export LDFLAGS="-L$SDKROOT/usr/lib/"

export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS

更新:此交叉编译的目的是使armv7(armv6)库不是命令行工具。

再来一次更新:我使用了以下内容:

CC="$DEVROOT/usr/bin/clang"
CXX="$DEVROOT/usr/bin/clang++"

./llvm/configure --host=i386-apple-darwin --target=armv7-apple-darwin --build=armv7-apple-darwin --enable-optimized --disable-debug --disable-expensive-checks --disable-doxygen  --disable-threads --enable-targets=arm 

我设法checking whether we are cross compiling... yesconfigure工具。 但是, make仍然输出x86_64二进制文件:(

原则上,您的配置调用看起来很好。 我正试图拍摄一些典型的错误:

  1. 每次改变建筑后你make clean了吗?
  2. 为什么你确定你的主机系统的LD,RANLIB等适合交叉编译? 它将覆盖自动配置的LD值。 (读取“export LD = ld”的行将在这里出错。)
  3. 您是否可以检查make输出中的典型编译器和典型链接器调用,以正确使用交叉编译工具?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM