Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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?

share|improve this question
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

5 Answers 5

up vote 3 down vote accepted

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.

share|improve this answer
    
Err...that lets you use native code in your apps, not compile things on your phone, no? –  Al E. 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
1  
Yes, but that is what was specifically asked for (and another, duplicate question, was deleted). –  Al E. Sep 7 '11 at 23:52

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.

share|improve this answer

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

share|improve this answer
    
It would be nice if you could provide the links to the apps. –  Al E. Aug 3 '12 at 20:06

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. You can also use CCTools as it's almost c4droid but free.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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