无法交叉编译手臂的C库(iOS) [英] Can't cross compile C library for arm (iOS)

查看:73
本文介绍了无法交叉编译手臂的C库(iOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从arm64开始交叉编译iOS的 libDSM .

I'm trying to cross-compile libDSM for iOS, starting with arm64.

我已经提取了源代码,并一直在尝试使用以下命令对其进行配置:

I've pulled down the source code and have been trying to configure it using the following:

export XCODEDIR=$(xcode-select -p)
export DEVROOT=${XCODEDIR}/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS.sdk
export CFLAGS="-arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -mios-version-min=10.0 -I$SDKROOT/usr/include/"
export LDFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=10.0"

./configure --host arm-apple-darwin --prefix $PWD/build/arm64

它因以下错误而停止:

configure: error: C preprocessor "/lib/cpp" fails sanity check

configure.log中的错误是:

The error in the configure.log is:

configure:4504: checking how to run the C preprocessor
configure:4535: gcc -E  conftest.c
In file included from conftest.c:14:
In file included from /Users/pmacro/Downloads/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include/limits.h:37:
In file included from /Users/pmacro/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/usr/include/limits.h:63:
/Users/pmacro/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/usr/include/sys/cdefs.h:761:2: error: Unsupported architecture
#error Unsupported architecture
 ^

configure.log中较早的消息可能是相关消息:

A possibly related message earlier in configure.log is:

configure:3752: ./conftest

./configure: line 3754: ./conftest: Bad CPU type in executable

请注意,对于x86_64(我正在构建的平台),它可以很好地进行编译,但是对于任何arm架构,它都失败.

Note that it compiles fine for x86_64 (the platform I'm building on), but for any arm architecture it fails.

我看过iOS交叉编译的示例,它们似乎都遵循了这些步骤.我正在运行预发行版软件(macOS Sierra和Xcode 8),但是在Sierra上运行Xcode 7时遇到相同的问题.感谢您的帮助.

I've looked at examples of cross compiling for iOS and they all seem to be following these steps. I am running pre-release software (macOS Sierra and Xcode 8), but I get the same issue when running Xcode 7 on Sierra. Thanks for any help.

推荐答案

问题是我需要在CPPFLAGS和CFLAGS中指定体系结构(-arch arm64).

The problem was that I needed to specify the architecture (-arch arm64) in CPPFLAGS as well as CFLAGS.

这篇关于无法交叉编译手臂的C库(iOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆