[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ARM toolchain for Android - Gcc ON android

On Thu, Jul 14, 2011 at 9:37 AM, Earlence Fernandes
<earlenceferns@gmail.com> wrote:
> I have to be clearer. Just the C compiler from GCC and its associated
> linker. The bare minimum to produce an executable. (without pthreads or
> anything of the sort)

 it's not as simple as you imagine it to be.

 you want, i believe arm-eabi-none-gcc (something like that) - i.e.
you want something similar to what u-boot can use - and it's still
going to be large.  the issue is that things like running into
floating-point exceptions (divide by zero) require to call a function
that then generates an exception on your application's behalf: this
function is nothing to do with the gcc compiler (it's a runtime
exception, not a compile-time exception) so it is in gnu libc instead.
 repeat this process for dozens / hundreds of cases and you start to
see why gcc is so tied to gnu libc.

 perhaps you might instead want to look at the PIC c compiler: it
supports a subset of c, and you *might* find there's a version which
supports ARM.   what's its damn name...

 apt-cache search small c compiler

beef - flexible Brainfuck interpreter
sdcc - Small Device C Compiler (DFSG version)
tcc - Small ANSI C compiler

hmmm, nope - no good.

hmm, try this: http://www.codemist.co.uk/ncc/index.html

basically, whatever you do, you have your work cut out and are going
to need to understand more of what's involved.  or, use an external
media to store the development environment (or an nfs mount)


> -Earlence
> On Thu, Jul 14, 2011 at 10:35 AM, Earlence Fernandes
> <earlenceferns@gmail.com> wrote:
>> > i.e. do you *absolutely have* to have gcc installed on the actual
>> > device.
>> yes. no other way. And is should be as small as possible. preferably in
>> 10-15 MB. Just GCC, linker, bionic, system headers. nothing else.
>> otherwise, Can you tell me what directions you followed to compile gcc for
>> android?
>> -Earlence
>> On Thu, Jul 14, 2011 at 10:33 AM, Luke Kenneth Casson Leighton
>> <lkcl@lkcl.net> wrote:
>>> On Thu, Jul 14, 2011 at 7:02 AM, Earlence Fernandes
>>> <earlenceferns@gmail.com> wrote:
>>> >
>>> > Hello,
>>> >
>>> > We are security researchers at Vrije Universiteit Amsterdam. We have a
>>> > scenario where we need to be able to compile a C source on the Android
>>> > device itself. Hence, I came upon the R project's Android port:
>>> >
>>> > http://rwiki.sciviews.org/doku.php?id=getting-started:installation:android
>>> >
>>> > I could not find who created the "android gcc", and I posted on the R
>>> > porting list. They directed me here.
>>> >
>>> > Good news is that I've tried the gcc on the device and it works like a
>>> > charm.
>>> > question is, the size is really large.
>>>  yes? and? that's normal.
>>> > We have simple C files with no threading and the like.
>>>  welcome to embedded application development.  have you seen the size
>>> of the android development environment itself? :)
>>> > Just bionic + linux system headers + lib math. Nothing else.
>>>  you may be able to use uclibc instead of libc6.
>>> > I was wondering whether I could strip the toolchain down to a bare
>>> > minimum?
>>> > Or what were your steps while building it in the first place, so that I
>>> > can exclude things not needed up front?
>>>  is it possible to either use an nfs mount, or to have the compiler on
>>> an external usb or other external media?  i.e. do you *absolutely
>>> have* to have gcc installed on the actual device.
>>>  l.

Reply to: