Issue
Here is the basic C source code :
#include <stdio.h>
int main(void) {
puts("hello world!");
return 0;
}
I am able to compile for Android with NDK toolchain with :
aarch64-linux-android21-clang test.c
It generates an a.out file that I transfer to the Android device with :
adb push a.out /data/local/tmp
adb shell chmod 777 /data/local/tmp/a.out
When I try to run it with:
adb shell /data/local/tmp/a.out
I have the message : "/system/bin/sh: /data/local/tmp/a.out: No such file or directory"
What am I doing wrong?
Solution
In my case, I had to use "armv7a-linux-androideabiXX-clang" for compilation and then it is ok. XX must be replaced by the API version.
On my windows system, clang binaries and scripts are in the folder "D:\AndroidSdk\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\bin"
The most recent script that can be used is "armv7a-linux-androideabi29-clang++.cmd" and it is ok for compiling C sourcecodes for running on Samsung A3 phones in my case.
I think this is because this is not a 64-bit kernel and I figured that out after Eugene Sh asked me in comments to this question (if he adds an answer then I'll accept it).
Answered By - KotlinIsland
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.