Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android NDK fatal error: stdio.h: No such file or directory #include <stdio.h>

I am trying to build QPSQL driver for my Qt android project in my Archlinux which is failing constantly

configure: error: C preprocessor "/opt/AndroidSDK/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp" fails sanity check

So I tried simple hello World Program :-

% /opt/AndroidSDK/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp t.c
# 1 "t.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "t.c"
t.c:1:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.

This means arm-linux-androideabi-cpp preprocessor is not working , Right ? But my other Projects from Qt Creator and Android Studio builds and runs fine

What should I do ? I tried updating NDK to 18 which ended up horribly as they replaced gcc with clang. So I have r17b and latest android SDK .

like image 425
LightSith Avatar asked Sep 26 '18 17:09

LightSith


1 Answers

You can't invoke the tools in $NDK/toolchains without passing a whole bunch of flags to point them at the sysroot (enabling this sort of use case is an r19 feature).

Use https://developer.android.com/ndk/guides/standalone_toolchain to configure a toolchain for this sort of use.

like image 109
Dan Albert Avatar answered Nov 11 '22 02:11

Dan Albert