help / color / mirror / Atom feed
* Ada on Android and iOS?
@ 2014-01-22 11:39 coding.rascal
  2014-01-22 15:43 ` Ludovic Brenta
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: coding.rascal @ 2014-01-22 11:39 UTC (permalink / raw)


I am interested in developing commercial Ada software for Android and iOS (both of which I have never developed for, btw). I've spent several days trying to figure out how to create my own cross compiler for the ARM processor. Below are some of the links I've been using as reference.

Since both iOS and Android have a native interface API to allow people to develop software in languages other than Objective-C and Java, I am really hoping all I need to do is the following:

1) Compile my own native version of GCC 4.8.2 with Ada enabled. Let's call this My_Native_GCC (Note: I know I can just use 4.6, but I'd like to use the latest version of GCC)

2) Copy the header files of the target platform into my own target root directory

3) Compile and install a cross version of binutils 2.24 with My_Native_GCC.

4) Use My_Native_GCC to compile a minimal version of GCC that does not depend on GLIBC and outputs code for the target platform. Let's call this Min_Target_GCC. (NOTE: This is really for Android since they have the crappy Bionic libc)

5) Use Min_Target_GCC to compile and install a new version of GLIBC for the target platform.

6) Use Min_Target_GCC to compile and install a full version of GCC that generates code for the target platform and uses the new GLIBC.

So far, I've only attempted to do the above for the Android platform. I was successful in creating my own GCC 4.8.2 with Ada enabled. The only weird thing about my version is that I always need to use -I to include the paths of the C++ header files for my version of GCC. Otherwise, it can't find files like cstring.

For step 2, I downloaded the latest r9c of the Android NDK and copied over the contents of ~/android-ndk-r9c/platforms/android-17/arch-arm/usr/include into my own target root directory. Since GLIBC requires headers for Linux v2.6.19 or higher, and the NDK is bundled with Linux headers v2.6.18 (per the version.h file they include), I ended up grabbing the 3.0.31 Linux headers from Samsung's website via their Jelly Bean update Zip file My phone is the ATT S3 model, btw.

Step 3 and 4 completed without problems. However, I am now stuck at Step 5. The building of the new GLIBC fails on ../sysdeps/unix/sysv/linux/gethostid.c with the following error:

### make[2]: Entering directory `/home/rascal/workspace/cross_build/glibc-2.18/src/misc'
### /opt/custom_tools/cross/android/api/17/arm-linux-androideabi/bin/arm-linux-androideabi-gcc-4.8.2 ../sysdeps/unix/sysv/linux/gethostid.c -c -std=gnu99 -fgnu89-inline  -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes   -fexceptions      -I../include -I/home/rascal/workspace/cross_build/glibc-2.18/build/misc  -I/home/rascal/workspace/cross_build/glibc-2.18/build  -I../ports/sysdeps/unix/sysv/linux/arm/nptl  -I../ports/sysdeps/unix/sysv/linux/arm  -I../nptl/sysdeps/unix/sysv/linux  -I../nptl/sysdeps/pthread  -I../sysdeps/pthread  -I../ports/sysdeps/unix/sysv/linux  -I../sysdeps/unix/sysv/linux  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../nptl/sysdeps/unix/sysv  -I../ports/sysdeps/unix/sysv  -I../sysdeps/unix/sysv  -I../ports/sysdeps/unix/arm  -I../nptl/sysdeps/unix  -I../ports/sysdeps/unix  -I../sysdeps/unix  -I../sysdeps/posix  -I../ports/sysdeps/arm/nptl  -I../ports/sysdeps/arm/include -I../ports/sysdeps/arm  -I../ports/sysdeps/arm/soft-fp  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I../nptl  -I../ports  -I.. -I../libio -I. -nostdinc -isystem /opt/custom_tools/cross/android/api/17/arm-linux-androideabi/lib/gcc/arm-linux-androideabi/4.8.2/include -isystem /opt/custom_tools/cross/android/api/17/arm-linux-androideabi/lib/gcc/arm-linux-androideabi/4.8.2/include-fixed -isystem /opt/custom_tools/cross/android/api/17/arm-linux-androideabi/include  -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC     -o /home/rascal/workspace/cross_build/glibc-2.18/build/misc/gethostid.o -MD -MP -MF /home/rascal/workspace/cross_build/glibc-2.18/build/misc/gethostid.o.dt -MT /home/rascal/workspace/cross_build/glibc-2.18/build/misc/gethostid.o
### ../sysdeps/unix/sysv/linux/gethostid.c: In function 'gethostid':
### ../sysdeps/unix/sysv/linux/gethostid.c:71:17: error: 'MAXHOSTNAMELEN' undeclared (first use in this function)
###    char hostname[MAXHOSTNAMELEN + 1];
###                  ^
### ../sysdeps/unix/sysv/linux/gethostid.c:71:17: note: each undeclared identifier is reported only once for each function it appears in
### ../sysdeps/unix/sysv/linux/gethostid.c:71:8: warning: unused variable 'hostname' [-Wunused-variable]
###    char hostname[MAXHOSTNAMELEN + 1];

I tried compiling a native version of GLIBC to see if I get the same error, but it compiled just fine. So it appears to be an issue when I have the build process use my designated target root path that includes the header files from the Android NDK and the Galaxy S3 header files. But before I continue spending a great deal of time investigating this error, I'd like to know the following:

1) Will the 6 step process I laid out above only lead me to a dead end? I know about GNATdroid. The main reason why I am trying to avoid using GNATdroid is because I am hoping I can figure out a common process that allows me to create toolchains for both Android and iOS (hopefully, with the need to simply switch between the set of header files between the two platforms).

2) Does GNAT work with the Bionic library even though it doesn't implement the entire C runtime and is not POSIX compliant. I'd like to be able to use Ada tasks and protected types on Android.

3) Does GNAT work with EGLIBC and uCLIBC?

4) GNATdroid is built for Android 2.3. Does this mean an Ada Android app is limited to the capabilities of that old Android API? If yes, then is there any chance GNATdroid will be updated to a more recent version of Android (preferably Jelly bean)?

BTW, my development machine is Kubuntu 13.10 running on a Core-i7 based laptop.


Coding Rascal

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-06-21  9:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-22 11:39 Ada on Android and iOS? coding.rascal
2014-01-22 15:43 ` Ludovic Brenta
2014-01-22 16:55 ` jrmarino
2014-01-22 21:35   ` coding.rascal
2014-01-22 23:07     ` jrmarino
2014-01-23 19:20 ` Dan'l Miller
2014-01-23 20:19   ` Micronian Coder
2014-01-23 23:48 ` Lucretia
2023-06-20 13:31   ` Guillermo Hazebrouck
2023-06-20 17:43     ` Luke A. Guest
2023-06-20 18:08       ` Luke A. Guest
2023-06-20 18:45         ` Luke A. Guest
2023-06-20 19:17       ` Simon Wright
2023-06-20 19:29         ` Luke A. Guest
2023-06-20 19:35         ` Luke A. Guest
2023-06-20 21:27     ` Luke A. Guest
2023-06-21  7:01       ` Guillermo Hazebrouck
2023-06-21  9:06         ` Luke A. Guest

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox