Compile, Install, Run Linux Apps on Android

The advantage of using a POSIX based mobile OS is that you can run and install any Linux applications on your mobile (smartphone) with ease. And thanks to Open Source, its even easier to Compile, Install & Run Linux Applications on Android.

To get basic Linux apps running on Android, you need BusyBox. To give you some background, BusyBox is a software application that provides many standard Unix tools, much like the larger (but more capable) GNU Core Utilities. BusyBox is designed to be a small executable for use with the Linux kernel, which makes it ideal for use with embedded devices. It has been self-dubbed “The Swiss Army Knife of Embedded Linux”.

Using this guide, you’ll be able to:

  • Compile Linux C, C++ app directly on Android
  • Install, Run Linux apps on Android.

How to Compile, Run Linus Apps on Android

Step 1. Install BusyBox from Play Store (requires root). If you don’t have Root access, you can follow steps mentioned in the video which involves adb push for busybox binary to /data/ and setting permissions.

BusyBox would allow you to install various Linux apps on Android coz BusyBox is bundled with all the runtime dependecies.

Step 2. To make your environment even more capable, lets go ahead and install BostBrew Basil from Play store.

BostBrew Basil bootstraps the base system and do some basic package management by using uses Dpkg and Apt instead of Opkg. This will let you install various linux packages, this is where BostBrew shines.

Step 3. Install Linux apps using APT Package manager

To install apps using apt package manager, all you need to do is:

su
bostbrew
apt-get install gcc g++

This will install gcc, g++ compilers and you can specify any other package name and ARM version should be automatically installed to your android.

Step 4. Compiling C, C++ source code on Android

Compile any source file using g++ and run it:

g++ ./sourceCode.cpp
./a.out

That’s it. You’ve successfully compiled and run your own C code.

You can watch the video below, it essentially covers the same steps in an easy to follow tutorial:

We write latest and greatest in Tech GuidesAppleiPhoneTabletsAndroid,  Open Source, Latest in Tech, subscribe to us @geeknizer OR on Facebook FanpageGoogle+.

GD Star Rating
loading...
GD Star Rating
loading...
Compile, Install, Run Linux Apps on Android, 6.6 out of 10 based on 18 ratings

6 thoughts on “Compile, Install, Run Linux Apps on Android”

  1. Recommending people who you don’t know and may not have much technical expertise to su instead of prefacing each command with sudo seems like asking for trouble

    GD Star Rating
    loading...
    GD Star Rating
    loading...
    Reply
  2. I’m a little bit confused about the C compilation. Do you have to compile the source from the program you got in APT? Or is that just an extra feature you can use?

    GD Star Rating
    loading...
    GD Star Rating
    loading...
    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.