1 message in com.googlegroups.android-developers[android-developers] Android Native C...
FromSent OnAttachments
Shawn McMurdo07 Jul 2008 15:23 
Subject:[android-developers] Android Native Code Cross Dev With Latest CodeSourcery Toolchain
From:Shawn McMurdo (shaw@yahoo.com)
Date:07/07/2008 03:23:17 PM
List:com.googlegroups.android-developers

Hi,

I am trying to use the latest CodeSourcery G++ Lite ARM cross dev toolchain to
build native code for Android. I looked at some messages in the archive from November about doing this but the
CodeSourcery toolchain seems to have changed since then. I have a simple "Hello World" in c and try to build it statically for Android
with:

$ cat build.sh #!/bin/sh

arm-none-eabi-gcc \ hello.c \ -static -o hello \ -Xlinker --script -Xlinker
~/CodeSourcery/Sourcery_G++_Lite/arm-none-eabi/lib/generic.ld

which gives me warnings like this: $ build.sh /home/shawn/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.2.3/../../../../arm-none-eabi/lib/libcs3unhosted.a(unhosted-_close.o):
warning: IO function '_close' used [...few more similar warnings...]

This produces an executable: $ file hello hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not
stripped

When I push it to the emulator and run it, it seems to hang without printing
anything. strace shows that it is trying to use an unknown system call: # strace ./hello execve("./hello", ["./hello"], [/* 10 vars */]) = 0 syscall: unknown syscall trap 0x00002a9c

So, I have a couple of questions. 1. What linker script should I use for Android if not generic.ld? 2. What's the difference between hosted and unhosted? 3. Any suggestions on what I need to do to make this work?

Thanks! Shawn