cross compiler toolchain - Galaxy S II Q&A, Help & Troubleshooting

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

Related

C++ Compiler for Android?

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.

[Q]Java Compiler in Android

Is there any way to compile java applications in android?
i wanna write simple java applications like i do in ms-dos
"javac file.java, java file".
could somebody tell me if i can do it?
Meraklis56 said:
Is there any way to compile java applications in android?
i wanna write simple java applications like i do in ms-dos
"javac file.java, java file".
could somebody tell me if i can do it?
Click to expand...
Click to collapse
if you want to build an app of course you can but i don`t know if that`s so simple. depends on knowledge
but you can start here:
1. http://developer.android.com/sdk/index.html
2. http://www.eclipse.org/downloads/
3. you will need java too
are you sure i do this on my mobile?
if i got it,right this is how i make application in my pc,not in my xperia!
i want that, in my android
Meraklis56 said:
are you sure i do this on my mobile?
if i got it,right this is how i make application in my pc,not in my xperia!
i want that, in my android
Click to expand...
Click to collapse
ohhh you won`t specify
download terminal emulator from market and you will have access to shell through phone
well u cant , cause Android doesnt have a JVM , it has a Dalvik Virtual Machine, and its optmized for mobile aplications and for the hw of the device, but u can emulate some plataform, but if u want to compile just some java code, there some solutions in the forum like install ubuntu and compile there, but an aplications native for android is a lil' hard
edit---
you can read this, is very helpfull...
http://en.wikipedia.org/wiki/Dalvik_(software) Dalvik VM
http://developer.android.com/reference/java/lang/Compiler.html Compiler API ANDROID (u can use it =) in ur aplication)
installing/emulating ubuntu just for compiling java is a bit out of my limits!
i dont want to compile any crazy program, just some easy programs.
there is not other solution, than this?
java compilation on android device
I'm looking to do likewise for various reasons.
One is I live in a tent and the droid device consumes less power than my laptop.
Two is that I'm developing a platform that moves some 'programmer space' activities to user space. Though with java the later can normally be accomplished wo authoring any source or compiling by using introspection and object serialisation (granted an android based dx is needed here) there are use levels of the platform that afford source authoring and compilation.
Having said that as far as I can tell a javac for android is in order.
Thus: openjdk.java.net/groups/compiler/README.html
One needs to verify the source's class dependencies and see if the android vm (the dalvik vm really) implements those classes. If and where not either the compiler code needs to be modified to use dalvik implemented java classes or the dalvik vm extended to accommodate the additional classes, again if any, that the javac source uses.
The determination as to which direction to take need consider the effort involved
either way and the legalities of either way while noting that the dalvik vm is allready the subject of a lawsuit (see Controversy at en.m.wikipedia.org/wiki/Dalvik_(software) ).
Personnaly I'm leaning to modify the javac source if necessary as this
openjdk.java.net/legal/
doesn't look prohibitive in so long, I think, as the language specs are met or more simply.in so long as the modified to run on android javac produces the same results as the original.
If you're ready to get yor hands dirty (not all coding is drag and drop) here ya go
download.java.net/openjdk/jdk6/
Maybe we'll meet somewhere along the way.
Sp
I got ClassCycle and ran it on the classes that resulted from me compiling the javac sources
in the openjdk's langtools directory . These sources are a programatic interface to javac and
are said to be used at one's own risk.I had trouble compiling the 'actual' sources
but will try again.
Once I can make heads or tails of the ClassCycle report I can provide a list
of javac's class deps.
Why one might ask would is any of this class deps stuff needed?
Dx the Java bytecod+e and run it. Droid has a vm, should be ok.
The problem is that Dalvik, at least does not implment awt and swing. What this means is that there is no native implementation for those classes' bytecode to be runtime instantiated towards.
Likewise if there are javac class deps that the dalvik vm does not implement there will be no native implementation in those areas and the bytecode won't run.
Till I get the list,
Steve
Script Layer for Android
Meraklis56 said:
Is there any way to compile java applications in android?
i wanna write simple java applications like i do in ms-dos
"javac file.java, java file".
could somebody tell me if i can do it?
Click to expand...
Click to collapse
For rooted systems there is a way to run Ubuntu in the phone/tablet. I don't remember the details, just google for it. I only remember that you should use a VNC viewer to connect to the xserver running in your own system.
I don't know if you can access from that Ubuntu to the resources of your Android (sensors, GPS, camera, and so on).
If you want to be able to create small programs in an easy way for your Android and being able to access all sensors and peripherals of your phone you should consider using SL4A (Script Layer for Android).
It's a base scripting system. On top of it you can install Python, PHP, Bash. So you can write your own scripts using any text editor in the phone, and run it without using any computer in the process
java compilation on android device
A year later and:
JavaIDEDroid: http://code.google.com/p/java-ide-droid
AIDE: https://play.google.com/store/apps/details?id=com.aide.ui&hl=en
and probably others as well.

[Q] Android cloud compiler?

I've been looking into compiling code directly on my phone and have found a few ide's (pretty much just text editors) that can compile java, pascal, c, c++ etc.. They use online compilers to compile the code. Is it possible to compile code for android this way and have the online compiler return an apk? Given the sdk was installed server side.
codenvy.com
That good to use,but android Compile have a lot of bug!

Mixing-in neon in armv6 builds

I build for regular armeabi with -march=armv6, but in my project I have some neon optimized code and I enable that code at run-time after checking if the cpu supports neon. The app obviously has to run on older devices as well.
So, how the hell am I supposed to do that simple task with android crappy build?
I can't specify extra c-flags for some files. To build for neon with this crapware you absolutely have to enable armeabi-7a which means that compiler if free to generate armv6t2 or armv7 instructions, which means that binary might sigill on older devices. The only way for me do that simple task is to build neon asm manually and use the static lib in the main armeabi project.
Seriously, is android build one more example of ridiculous crapware made from regular makefiles so that you can't actually do normal makefiles anymore? Is there official android forum, where I could ask that question from them, or it's also disfunctional?
thanks
Please use the Q&A Forum for questions &
Read the Forum Rules Ref Posting
Moving to Q&A

Why is ART slow on x86_64?

I recently wanted to try out how well ART would work on a x86_64 desktop, so I downloaded the Android source code and compiled ART with m build-art-host.
I then decided to do some very unscientific benchmarks and I found out that for mostly IO-bound stuff (parsing a relatively simple file format), it's about twice as slow as OpenJDK 8 with its HotSpot VM, while for mostly GC-bound stuff (concatenation of 2 string constants in a for-loop), it's about 25 times as slow as OpenJDK with HotSpot on my PC. I also found out it's about 10% slower (for the GC-bound stufff) than on my phone.
My phone is a Samsung Galaxy A50 and my desktop has an AMD Ryzen 7 3700X, 16 GB of RAM and a NVMe SSD, so that was not the result I was expecting.
I thought: "Maybe something is wrong with the way I compiled ART?", so I ran the same benchmarks in an Android 10 x86_64 AVD as provided by Google, where I got the same results, so I think that rules out me doing something wrong with compiling ART.
Is ART really supposed to be this slow on x86_64? And is this due to the fundamental design of ART or is it just not properly optimized for x86_64 (due to most Android devices using ARM CPUs)?
@wb9688
I guess you compare things that are not comparable: ART is shorthand for Android Runtime & x86_64 is a CPU architecture.
ART performs the translation of the application's bytecode into native instructions that are later executed by the mobile device's runtime environment ( Linux Runtime ). This is done once - keyword: dex2oat - namely when app gets istalled.
IMHO if ever then you could compare performance of the CPU-architecture arm64 with x86_64 - both 64-bit - if both have same clock-speed, of course.
jwoegerbauer said:
@wb9688
I guess you compare things that are not comparable: ART is shorthand for Android Runtime & x86_64 is a CPU architecture.
ART performs the translation of the application's bytecode into native instructions that are later executed by the mobile device's runtime environment ( Linux Runtime ). This is done once - keyword: dex2oat - namely when app gets istalled.
IMHO if ever then you could compare performance of the CPU-architecture arm64 with x86_64 - both 64-bit - if both have same clock-speed, of course.
Click to expand...
Click to collapse
I know what ART is and that it could compile a Dalvik Executable ahead of time into a native binary.
However as the AMD Ryzen 7 3700X in my PC is much faster than the CPU in my Samsung Galaxy A50, I'd also expect ART to be much faster on my PC, which is not the case. The only reason I could think of would be that ART is not well optimized for x86_64 (for which it will have to generate different instructions as for e.g. ARM).
Thanks for clarification.

Categories

Resources