Galaxy
Galaxy

Reputation: 2481

How to run a C program in adb shell?

So adb shell gives one a linux terminal into an android phone, when it is connected to a computer. One can run all the standard linux commands like ls and cat inside the android phone, and explore the android filesystem using the adb shell.

Now I wonder, is it possible to use a C/C++ compiler such as clang or gcc to compile and execute a C/C++ program in the android phone, as on linux? I am not talking about android app development here, I mean a linux command line C/C++ program for android. Also, can I use the C standard library and linux system calls such as fork(), exec(), kill(), and working with file descriptors, in the android adb shell, just as I would do it on linux?

Upvotes: 2

Views: 1542

Answers (1)

magesh gopal
magesh gopal

Reputation: 46

Yes. You can . For that you need copy your compiler exe's to android file system. From there you can easily call. Same time make sure that all pre-builed libs in android PATH folder.

Upvotes: 1

Related Questions