After googling this topic and finding nothing, I figured XDA was the place to go. I am looking for a way to get a C++ compiler working on my phone (mytouch slide) or android in general.
Thanks in advance
Que? Like a C++ compiler to compile for android? Why would u want this C++ don't run native on Android it must be called from java so it would be pointless.
There is an sdl port around that required zero knowledge of.java but I believe it still has to compile the java each time. If not it could be possible...
Sent from my Nexus One
I don't want to run the programs on my phone, just compile
Compile for what?
What is the Android NDK?
The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications.
Android applications run in the Dalvik virtual machine. The NDK allows you to implement parts of your applications using native-code languages such as C and C++. This can provide benefits to certain classes of applications, in the form of reuse of existing code and in some cases increased speed.
The NDK provides:
* A set of tools and build files used to generate native code libraries from C and C++ sources
* A way to embed the corresponding native libraries into an application package file (.apk) that can be deployed on Android devices
* A set of native system headers and libraries that will be supported in all future versions of the Android platform, starting from Android 1.5
* Documentation, samples, and tutorials
The latest release of the NDK supports these ARM instruction sets:
* ARMv5TE (including Thumb-1 instructions)
* ARMv7-A (including Thumb-2 and VFPv3-D16 instructions, with optional support for NEON/VFPv3-D32 instructions)
Future releases of the NDK will also support:
* x86 instructions (see CPU-ARCH-ABIS.TXT for more information)
ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and NEON instructions. You can target either or both of the instruction sets — ARMv5TE is the default, but switching to ARMv7-A is as easy as adding a single line to the application's Application.mk file, without needing to change anything else in the file. You can also build for both architectures at the same time and have everything stored in the final .apk. For complete information is provided in the CPU-ARCH-ABIS.TXT in the NDK package.
The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES (3D graphics library), the JNI interface, and other libraries, as listed in the section below.
The NDK will not benefit most applications. As a developer, you will need to balance its benefits against its drawbacks; notably, using native code does not result in an automatic performance increase, but does always increase application complexity. Typical good candidates for the NDK are self-contained, CPU-intensive operations that don't allocate much memory, such as signal processing, physics simulation, and so on. Simply re-coding a method to run in C usually does not result in a large performance increase. The NDK can, however, can be an effective way to reuse a large corpus of existing C/C++ code.
Please note that the NDK does not enable you to develop native-only applications. Android's primary runtime remains the Dalvik virtual machine.
The ndk allows u to use c++ c/c++ code in Android. That code must be called from java tho.
Sent from my Nexus One
I don't think you guys are understanding his question... He's not looking to write apps for Android... he's writing stuff in C++ (presumably for desktop or maybe other embedded applications, I dunno) and just wants to be able to compile that code on his Android device...
Now as far as an answer to that question, they did kinda cover it... Since pretty much everything in Android runs in Java, I believe it would be pretty difficult to write a C++ compiler that could run on Android.
To install an compiler in your Android device, google around for how to install Debian in it. Don't be afraid, you install it in parallel of Android, you will need a command or terminal window as well (available in the marketplace).
Debian comes with everything you need to compile in your device.
I hope I was useful.
Cheers
Thank you abrigham for clearing that up for me. You are exactly correct.
Ernestus, that seems like it would cause more problems then it would be worth
hmm.. i was googling for this as well.. thought it'll be useful to have this around.
JDV28 said:
Thank you abrigham for clearing that up for me. You are exactly correct.
Ernestus, that seems like it would cause more problems then it would be worth
Click to expand...
Click to collapse
Next best option then is to cross-compile to Android/ARM from another platform. The arm-eabi toolchain provided by Google's NDK is one option as others have already mentioned.
Codesourcery ARM toolchain is another, for Linux i686 theres link to the downloadable archive see this post (search for 'wget THISLINK' text on that page).
- jc
If your looking to corss compile for android, check this link out.
http://teslacoilsw.com/dropbear
Installing debian isn't too bad, and would give you the most flexibility for compiling on the phone.
You could also ssh into another computer using connectbot or some other terminal and code/compile remotely.
Another way to do remote compiles is continuous integration. Edit/upload the file to your repository, and using a server such as Jenkins, run the compile and view the results through the browser or an app such as Hudson2Go. Jenkins will also auto-compile on edits and can send you a text if the build fails. Jenkins is very easy to setup.
Try finding an online c++ compiler or you could connect to a windows or linux machine/server to upload andcompile your c++ files.
JDV28 said:
After googling this topic and finding nothing, I figured XDA was the place to go. I am looking for a way to get a C++ compiler working on my phone (mytouch slide) or android in general.
Thanks in advance
Click to expand...
Click to collapse
Use "c4droid" this is a paid app.. anywy if you like search on the market.
Another alternitiv is out there now. Not sure how good it works.
C / C++ Compiler
im looking for compiler too i found i market a4droid compiler but it costs... and i couldnt find enywhere free apk
Easiest thing to do would be a chroot Linux environment from an existing distribution, like Ubuntu. Then compilers for nearly any language you can think of are an "apt-get install" away.
If you're running CyanogenMod 7, you have a large SD card, and you don't mind repartitioning the SD card and shaving off 2 GB or 4 GB for Linux, then I'll be posting a howto in the next day or two. I have Ubuntu 11.10 Oneiric Ocelot running out of /sd-ext cleanly, using only files from official sources (<32 MB file from cdimage.ubuntu.com and everything else via apt/dpkg with signature verification) rather than from rapidshare-like sites.
Or about a year ago there were instructions posted for unzipping a ~2 GB image containing an older version of Ubuntu downloaded from a filesharing site. You could do that if you have an immediate need.
you can download from my blog
http://dateno1.egloos.com/855501
it from https://market.android.com/details?id=com.n0n3m4.gcc4droid&feature=more_from_developer
it has some library problem but work well (i already compile few binary for my phone )
I think c4droid maches perfectly what you were looking for. I'm using it to work on my projects "on the road" and so far it works pretty well.
A little tricky to set up, since you need "gcc plugin for c4droid" but to choose g++ compiler, and builds are saved at "data/data/com.n0n2m3.c4droid/files/temp" or something like that...
There's another option, but you still have to pay: DroidEdit Pro. Perhaps better editor (didn't test it though) but without it's own compiler, you have to set up an external compiler from sftp server.
Hello every xda members,
I have some little questions,
Is there anyone who have a working native toolchain (binutils, gcc, newlib) that I can run under my Android Phone to build binaries directly under the phone using a terminal ?
Is there any other way to program/compile applications/binaries directly on the phone ?
I want to develop on the phone without any computer.
Thanks for your help
I was wondering the same. Found this:
specificimpulses.blogspot.com/2011/01/my-android-speaks-fortran-yours-can-too.html for building fortran natively, I think. Shouldn't be much different. Gcc is a bear to compile, at least as of 3.3.1(last time I built a cross compiler)
Here you go....
First one is ndk r23b aarch64 I built paralloid and its static busybox using this(after modifying paraloids build script a bit) I have only used it within a debian chroot, so I know it works outside termux environment. also has x86_64 toolchain alongside aarch64
GitHub - lzhiyong/termux-ndk: android-ndk for termux
android-ndk for termux. Contribute to lzhiyong/termux-ndk development by creating an account on GitHub.
github.com
I have never used this one, but It may be relevent, its the r21e ndk(r23b has bugs, this may work around)
EDIT:This r21e ndk just built the static busybox for aarch64 where r23b would only build armv7a also this one seems to have the 4.9 binaries in all archs!
GitHub - zaharchenko-main/termux-ndk: android-ndk for termux
android-ndk for termux. Contribute to zaharchenko-main/termux-ndk development by creating an account on GitHub.
github.com
Just noticed I answered this a decade late.
Leaving more native devel tools for my future reference...
Building arm64-v8a ndk toolchain to run on device
Now I know I've done this before. But I think I had to make an entire Application.mk file. I am trying to use either the Windows or Linux NDKr19 to build a standalone toolchain that contains ONLY the arm64 executable binaries. (essentially...
forum.xda-developers.com
Androw said:
Hello every xda members,
I have some little questions,
Is there anyone who have a working native toolchain (binutils, gcc, newlib) that I can run under my Android Phone to build binaries directly under the phone using a terminal ?
Is there any other way to program/compile applications/binaries directly on the phone ?
I want to develop on the phone without any computer.
Thanks for your help
Click to expand...
Click to collapse
@Androw
Prior to your next posting please read the guidances that are stuck on top of every forum like
[ATTN] : Read before posting - Any questions posted here will be MOVED or CLOSED
Please read the below before posting. Any questions not development related will be moved or closed. Forum Searching | Posting | The Basics: (Make sure you've read them before starting a new thread) Forum Rules Forum Search Google Forum...
forum.xda-developers.com
I've moved the thread to Q&A.
Regards
Oswald Boelcke
Senior Moderator
Hi,
Could someone please tell me how I could intercept all the syscalls while the phone is running?
I build the kernel from source code, and load it on the Nexus S 4G device, and I have already compiled a syscall interception module for Ubuntu. But, I do not know how a syscall interception LKM would look like for android, and how it could be incorporated into the kernel's source code to be compiled automatically when the kernel is built.
Would someone please help?
::Saman
Please use the Q&A Forum for questions Thanks
Moving to Q&A
Hello,
I built a croos compiler toolchain on Ubuntu 11.10 following this thread :
http://forum.xda-developers.com/showpost.php?p=18356849&postcount=5
I adapted it to Samsung Galaxy S2.
1- Is SGS2 using too the "neon" technology for FPU ? (I declared it , but not sure).
2-The build went fine. I picked C++ as language. Now I want to build a second one with Java. Do I have to use others folders, to separate these two environments, or shall I stay in same building directroy (/home/username/compil/crosstoll/bin), and just change my config file?
TY
gabx said:
Hello,
I built a croos compiler toolchain on Ubuntu 11.10 following this thread :
http://forum.xda-developers.com/showpost.php?p=18356849&postcount=5
I adapted it to Samsung Galaxy S2.
1- Is SGS2 using too the "neon" technology for FPU ? (I declared it , but not sure).
2-The build went fine. I picked C++ as language. Now I want to build a second one with Java. Do I have to use others folders, to separate these two environments, or shall I stay in same building directroy (/home/username/compil/crosstoll/bin), and just change my config file?
TY
Click to expand...
Click to collapse
I'm 90% certain the Exynos supports NEON.
Not sure if there's a point to a gcj cross-compile for Android. In fact there's rarely a point for anything beyond straight C (kernel, commandline binaries/tools)
neon..
It does support neon
Please help.
I need repack android.jar
Yesterday i read android source codes and i realize that classes have more methods than casual sdk provide.
So
1.download android 2.2 rev 1.1
2.Unjar it
3.unjar android 2.2 rev 3 from sdk
4.Replace classes
5.repack to jar
6.rewrite android.jar in sdk folder
Some classes causes warning due to missing objects. So you can delete them or replace from default.
But i have problem with classes that does not been in native android.jar. eclipse see namespace of package but classes not.
Idea: because android.jar contain only empty stub classes. it is only compiler reference and eclipse use it only to know android api.
So is absolutely right add stub if they exist in android system.
Question: why android not support all api functions?
Is somewhere cookbook "how to"
Create own android.jar?
"Try google" is not answer.
Sent from my HTC Wildfire using XDA App
Explain in proper English
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums & Read the Forum Rules
Moving to Q&A