用于 ARM 的 Clang cross-compilation

Clang cross-compilation for ARM

我正在尝试使用 arm-none-eabi(Debian 的软件包)headers 为 ARM(特别是 Cortex-M3)编译一个包含 stdint.h 的文件。命令是:

clang -I/usr/lib/gcc/arm-none-eabi/4.8/include \
    -target arm-none-eabi cfile.c -o cfile.o

-mcpu-mfpu-mfloat-abi 为简单起见省略)

Returns一个错误:

In file included from cfile.c:1:
In file included from ./cfile.h:4:
In file included from /usr/lib/gcc/arm-none-eabi/4.8/include/stdint.h:9:
In file included from /usr/lib/llvm-3.5/bin/../lib/clang/3.5.0/include/stdint.h:61:
In file included from /usr/include/stdint.h:25:
/usr/include/features.h:374:12: fatal error: 'sys/cdefs.h' file not found
#  include <sys/cdefs.h>
           ^
1 error generated.

我一直在关注 this guide

我的版本:

$ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.4-1+11-1) 4.8.4 20141219 (release)

关于如何解决这个问题有什么想法吗?

P.S.: 不是 this question.

的副本

要解决此问题,您必须安装 g++-multilib
g++-multilib - GNU C++ 编译器,一个相当可移植的 C++ 优化编译器。 它将安装所需的 headers.

作为 sysroot 选项的答案(来自评论部分): 你是绝对正确的 sysroot 应该与从 zips 安装的 cross-compilers 一起使用。从您尝试使用哪个编译器的问题中不清楚。