1

嗨,我正在尝试使用来自 android-ndk 的 gcc-4.9 在 Ubuntu 16.04 上交叉编译 Android arm64 的代码,但无法摆脱此错误:

aarch64-linux-android-gcc -o test.o -c test.c -Os -fPIE -Wall -DDBG
test.c:26:18: fatal error: poll.h: No such file or directory
#include <poll.h>
              ^
compilation terminated.
Makefile:16: recipe for target 'test.o' failed
make: *** [test.o] Error 1

我认为这是因为无法以正确的方式访问工具链,因为在我得到之前:

make: aarch64-linux-android-as: Command not found

请指教。

4

1 回答 1

0

谢谢yugr,把它变成独立的解决了它:

$NDK/build/tools/make_standalone_toolchain.py \
--arch arm64 --api 23 --install-dir /tmp/my-android-toolchain

之后我添加/tmp/my-android-toolchain/bin到 PATH 并且它起作用了。

于 2017-01-29T19:53:18.547 回答