Cross Ada Compiler for iOS Purposes

Tl dr
How can I compile Ada source code into a static library file suitable for iPad apps running iOS for communication? (GCC is optional. Solutions using LLVM or others are also welcome!)


I have a large Ada portable code library that I would like to use in an iPad / iOS project. My OS host is Mac OS X 10.9 (running GCC 4.8.1 installed in /opt/local with MacPorts). For this, I'm trying to create a cross-compiler GCC ARM with Ada support.

I can create a working GCC and GNAT that creates ARM executables, but I cannot create or install the standard Ada library that is required to create Ada code

The source packages I'm using are:

 gcc-4.8.1 binutils-2.24 libiconv-1.14 gmp-5.1.3 mpc-1.0.2 mpfr-3.1.2 

GCC Build Configuration:

 $ bin/arm-none-eabi-gcc -v --version Using built-in specs. COLLECT_GCC=bin/arm-none-eabi-gcc COLLECT_LTO_WRAPPER=/Users/ardnew/cross/libexec/gcc/arm-none-eabi/4.8.1/lto-wrapper arm-none-eabi-gcc (GCC) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Target: arm-none-eabi Configured with: /Users/ardnew/cross/src/gcc-4.8.1/configure --target=arm-none-eabi --prefix=/Users/ardnew/cross --with-cpu=cortex-a8 --enable-languages=c,ada --disable-multilib --enable-interwork --disable-threads --disable-shared --disable-nls --disable-lto --disable-libssp --disable-decimal-float --disable-libgomp --disable-libmudflap Thread model: single gcc version 4.8.1 (GCC) COLLECT_GCC_OPTIONS='-v' '--version' '-mcpu=cortex-a8' /Users/ardnew/cross/libexec/gcc/arm-none-eabi/4.8.1/cc1 -quiet -v -D__USES_INITFINI__ help-dummy -quiet -dumpbase help-dummy -mcpu=cortex-a8 -auxbase help-dummy -version --version -o /var/folders/4c/y_sll7bj6b9bt15389wr66_80000gn/T//ccrSSKFx.s GNU C (GCC) version 4.8.1 (arm-none-eabi) compiled by GNU C version 4.8.1, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='-v' '--version' '-mcpu=cortex-a8' /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/as -mcpu=cortex-a8 -meabi=5 --version -o /var/folders/4c/y_sll7bj6b9bt15389wr66_80000gn/T//ccZYvQLp.o /var/folders/4c/y_sll7bj6b9bt15389wr66_80000gn/T//ccrSSKFx.s GNU assembler (GNU Binutils) 2.24 Copyright 2013 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `arm-none-eabi'. COMPILER_PATH=/Users/ardnew/cross/libexec/gcc/arm-none-eabi/4.8.1/:/Users/ardnew/cross/libexec/gcc/arm-none-eabi/4.8.1/:/Users/ardnew/cross/libexec/gcc/arm-none-eabi/:/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/:/Users/ardnew/cross/lib/gcc/arm-none-eabi/:/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ LIBRARY_PATH=/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/:/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/lib/ COLLECT_GCC_OPTIONS='-v' '--version' '-mcpu=cortex-a8' /Users/ardnew/cross/libexec/gcc/arm-none-eabi/4.8.1/collect2 -X --version /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crti.o /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crtbegin.o crt0.o -L/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1 -L/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/lib /var/folders/4c/y_sll7bj6b9bt15389wr66_80000gn/T//ccZYvQLp.o --start-group -lgcc -lc --end-group /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crtend.o /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crtn.o collect2 version 4.8.1 /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld -X --version /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crti.o /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crtbegin.o crt0.o -L/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1 -L/Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/lib /var/folders/4c/y_sll7bj6b9bt15389wr66_80000gn/T//ccZYvQLp.o --start-group -lgcc -lc --end-group /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crtend.o /Users/ardnew/cross/lib/gcc/arm-none-eabi/4.8.1/crtn.o GNU ld (GNU Binutils) 2.24 Copyright 2013 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. 

A testing program to ensure its creation of ARM binary files:

 $ cat told_unit1.adb told_unit1.ads -- -- FILE: told_unit1.adb -- with Ada.Text_IO; use Ada.Text_IO; package body told_unit1 is procedure hello is begin put_line("hello, world"); end hello; function double(x : in float) return float is begin return x + x; end double; end told_unit1; -- -- FILE: told_unit1.ads -- package told_unit1 is procedure hello; pragma Export ( convention => C, entity => hello, external_name => "ada_hello" ); function double(x : in float) return float; pragma Export ( convention => C, entity => double, external_name => "ada_double" ); end told_unit1; 

Then compile the Ada code and test it with file :

 $ arm-none-eabi-gcc -c told_unit1.adb $ file told_unit1.o told_unit1.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped 

And then when I try to link the library object file, it pukes:

 $ arm-none-eabi-gnatbind -aO$ADA_OBJECT_PATH -Ltold told_unit1 error: "a-textio.ali" not found, "a-textio.adb" must be compiled 

Returning to my GCC build logs, I found that libada (which I believe is part of GNAT) was never built. When I try to run make all-target-libada from the GCC build directory, it eventually tells me:

 Configuring in arm-none-eabi/libada configure: loading cache ./config.cache checking build system type... x86_64-apple-darwin13.1.0 checking host system type... arm-none-eabi checking target system type... arm-none-eabi checking for arm-none-eabi-gcc... /Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/xgcc -B/Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/ -B/Users/ardnew/cross/arm-none-eabi/bin/ -B/Users/ardnew/cross/arm-none-eabi/lib/ -isystem /Users/ardnew/cross/arm-none-eabi/include -isystem /Users/ardnew/cross/arm-none-eabi/sys-include checking for C compiler default output file name... configure: error: in `/Users/ardnew/cross/src/gcc-4.8.1-obj/arm-none-eabi/libada': configure: error: C compiler cannot create executables See `config.log' for more details. make: *** [configure-target-libada] Error 1 

And so I check that config.log refers to it and find the following:

 configure:2351: $? = 0 configure:2340: /Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/xgcc -B/Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/ -B/Users/ardnew/cross/arm-none-eabi/bin/ -B/Users/ardnew/cross/arm-none-eabi/lib/ -isystem /Users/ardnew/cross/arm-none-eabi/include -isystem /Users/ardnew/cross/arm-none-eabi/sys-include -v >&5 COLLECT_LTO_WRAPPER=/Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/lto-wrapper Target: arm-none-eabi Configured with: /Users/ardnew/cross/src/gcc-4.8.1/configure --target=arm-none-eabi --prefix=/Users/ardnew/cross --with-cpu=cortex-a8 --enable-languages=c,ada --disable-multilib --enable-interwork --disable-threads --disable-shared --disable-nls --disable-lto --disable-libssp --disable-decimal-float --disable-libgomp --disable-libmudflap configure:2351: $? = 0 xgcc: error: unrecognized command line option '-qversion' xgcc: fatal error: no input files compilation terminated. configure:2351: $? = 1 configure:2371: checking for C compiler default output file name configure:2393: /Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/xgcc -B/Users/ardnew/cross/src/gcc-4.8.1-obj/./gcc/ -B/Users/ardnew/cross/arm-none-eabi/bin/ -B/Users/ardnew/cross/arm-none-eabi/lib/ -isystem /Users/ardnew/cross/arm-none-eabi/include -isystem /Users/ardnew/cross/arm-none-eabi/sys-include -g -O2 conftest.c >&5 /Users/ardnew/cross/arm-none-eabi/bin/ld: cannot find crt0.o: No such file or directory /Users/ardnew/cross/arm-none-eabi/bin/ld: cannot find -lg /Users/ardnew/cross/arm-none-eabi/bin/ld: cannot find -lc collect2: error: ld returned 1 exit status configure:2397: $? = 1 configure:2434: result: configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:2440: error: in `/Users/ardnew/cross/src/gcc-4.8.1-obj/arm-none-eabi/libada': configure:2444: error: C compiler cannot create executables See `config.log' for more details. 

So, now I am above my head and not quite sure what to do next. Looks like I'm missing the C time library for ARM, maybe?

Any help on configuring GNAT / libada for ARM purposes would be great.

Alternatively - is there an easier way to link Ada libraries to the iOS Xcode project?

+7
gcc arm ios ada llvm
source share
1 answer

Unfortunately, the answer is that there is no means of automatic magic for this. You can use the toolkit to verify transfers after the fact, but what you want is not yet available.

I had to deal with the same issue in the past. Another answer would greatly change one of my project budgets. Maybe someday.

Although I agree, I think that ultimately there is enough incompatibility that your source must be radically changed - reducing the value of what you are looking for to achieve here. After all, new investments are debris, but they will lead to a better source if you can afford it.

+1
source share

All Articles