6

I'm running Cyanogenmod 7 on my Nexus One, and I wanted to compile and run LAME on my phone. I've already downloaded the source package and have tried to ./configure it, but I'm told that neither cc nor gcc exist on the phone. Is there a way to get gcc for Android? I'm simply looking to be able to compile a few native applications like LAME for use on my ARM device. How can I go about doing this?

  • 4
    Is it necessary to compile on your phone, or would it be acceptable to compile for your phone? (in the second case, the executable is compiled elsewhere - on a PC perhaps - but compiled for the architecture of your phone) This could give you the basic idea: android-dls.com/wiki/index.php?title=Compiling_for_Android – Piskvor Sep 6 '11 at 16:08
  • I can't find a C compiler than runs on ARM, nevermind specifically gcc for Android. You're probably out of luck -- if gcc is ported it would probably take quite a while. – Matthew Read Sep 6 '11 at 16:13
2

You can write, compile and distribute native code as an Android Application.

Look here for more info about the NDK.

If you want it done without the official framework and application packaging then you'll need to look into cross-compiling the application for the ARM architecture.

  • 2
    Err...that lets you use native code in your apps, not compile things on your phone, no? – ale Sep 7 '11 at 15:12
  • I know that Al. I never said that it was to compile it on the phone. – DarthNoodles Sep 7 '11 at 17:43
  • 4
    Yes, but that is what was specifically asked for (and another, duplicate question, was deleted). – ale Sep 7 '11 at 23:52
4

I can't understand why I have to pay $3 for c4droid as it's just GCC with editor. Use new free C/C++ IDE and compiler on Android. It has a lot of included C/C++ examples and tutorials. Blog link, Google Play link (needs 190 MB).

You can also use CCTools as it's almost c4droid but free (needs 66 MB application storage + 30 MB internal storage).

3

Compiling applications does not take considerable processing power in general. I did it on my 286 all the time. The OP wants gcc on his phone.

Look for C4droid (C/C++ compiler) in the Google market. Then install the "GCC plugin for C4droid" from the market. (These do cost a couple dollars).

From the market description: "It's a plugin for c4droid, that allows it to compile C and C++ source code using GCC. It contains gcc 4.7 with Bionic (Android libc). Source code hadn't been modified, so you can compile it yourself, if you want."

https://play.google.com/store/apps/details?id=com.n0n3m4.droidc https://play.google.com/store/apps/details?id=com.n0n3m4.gcc4droid

Here's another package that includes gcc from the market: "Debian Kit" - https://play.google.com/store/apps/details?id=org.dyndns.sven_ola.debian_kit

  • It would be nice if you could provide the links to the apps. – ale Aug 3 '12 at 20:06
2

The app Terminal IDE has a built-in GCC ARM compiler for Android. You can install it, move it to another folder and then uninstall it. But make sure you have enough free memory (needs 150 MB).

1

Android Applications are compiled in a PC and then installed on the phone. In order to compile an Application you will need a considerable amount of computational power and a compiler, in this case, a C compiler.

In other words, you need a Computer to compile the application.

You will need to download and install in your computer the Android SDK, the gcc compiler and other tools and then you will be able to compile the application for your phone.

0

As an alternative, or if you wish to use 100% FOSS, you can install a native Linux installation on your device using apps such as Linux Deploy, and simply apt-get install gcc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.