1

Hi I am trying to cross compile code for Android arm64 on Ubuntu 16.04 with gcc-4.9 from android-ndk and cannot get rid of this error:

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

I think it is because the toolchain cannot be accessed the right way because before I got:

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

Please advise.

superhero1
  • 11
  • 1
  • 3
  • 1
    Are you compiling your own code or someone else's? What is `poll.h`? Is this from some API or is it your own header file? – Code-Apprentice Jan 29 '17 at 15:08
  • It's in the header `#include ` should be served by the toolchain – superhero1 Jan 29 '17 at 15:21
  • 1
    Just checking, have you converted default NDK toolchain to [standalone](https://developer.android.com/ndk/guides/standalone_toolchain.html)? – yugr Jan 29 '17 at 17:56

1 Answers1

0

Thank you yugr, turning it into standalone solved it:

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

After that I added /tmp/my-android-toolchain/bin to PATH and it worked.

superhero1
  • 11
  • 1
  • 3