Hi, I'm trying (again) to work out how to build a GNAT cross compiler with no runtime, but with the tools.
Firstly, I'd just like to ask, is this supposed to be possible? If it is possible, why is it so hard/impossible and why will nobody from AdaCore answer my questions regarding it? I'm wanting to start development on my kernel and would prefer not to use a hacky way to do it. I'm currently using binutils-2.21, newlib-1.19.0, gcc-4.5.2, latest mpfr, bmp, mpc and am trying to target arm-none-eabi to start with. I've firstly build binutils, then gcc C compiler, then newlib, now i'm trying to build C + Ada. I need the C stuff with newlib so I can build u-boot, but when I get to Ada, I don't need it at all. I'm configuring the second gcc build with: ../../../src/gcc-$GCC_VERSION/configure \ --prefix=$PREFIX \ --target=$1 \ $2 \ --enable-multilib \ --with-newlib \ --with-headers=../../../src/newlib-$NEWLIB_VERSION/newlib/libc/include \ --disable-nls \ --disable-shared \ --disable-threads \ --with-gnu-as \ --with-gnu-ld \ --enable-languages=c,ada \ --disable-libssp \ --disable-libada \ --with-gmp=$GCC_LIBS_PREFIX/gmp \ --with-mpfr=$GCC_LIBS_PREFIX/mpfr \ --with-mpc=$GCC_LIBS_PREFIX/mpc &> log.config.txt $1 is arm-none-eabi and $2 is the --enable-interworking passed as parameters to my build function. When I do a "make" it fails around here: make[2]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc' mkdir -p -- ./gnattools Configuring in ./gnattools configure: creating cache ./config.cache checking for a BSD-compatible install... /usr/bin/install -c checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... arm-none-eabi checking whether ln -s works... yes checking for x86_64-unknown-linux-gnu-gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed configure: updating cache ./config.cache configure: creating ./config.status config.status: creating Makefile make[2]: Entering directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gnattools' rm -rf ../gcc/ada/tools mkdir -p ../gcc/ada/tools (cd ../gcc/ada/tools; ln -s ../sdefault.adb ../snames.ads ../snames.adb .) touch ../gcc/stamp-tools # gnattools1-re make -C ../gcc/ada/tools -f ../Makefile \ "CC=gcc" "CFLAGS=-g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" "LDFLAGS=" "ADAFLAGS=-gnatpg -gnata" "ADA_CFLAGS=" "INCLUDES=-I. -I.. -I../.. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/config -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/../include -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc" "ADA_INCLUDES=-I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada" "exeext=" "fsrcdir=/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc" "srcdir=/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc" "GNATMAKE=gnatmake" "GNATLINK=gnatlink" "GNATBIND=gnatbind" "TOOLSCASE=cross" "LIBGNAT=" INCLUDES="" \ gnatmake-re gnatlink-re make[3]: Entering directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc/ada/tools' gcc -c -DCROSS_DIRECTORY_STRUCTURE -DIN_GCC `echo -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes |sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'` \ /home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada/link.c -o link.o gcc -c -DCROSS_DIRECTORY_STRUCTURE -DIN_GCC `echo -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes |sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'` \ -I. -I.. -I../.. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/../include -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc \ /home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada/targext.c -o targext.o gnatmake -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -u sdefault --GCC="gcc " gcc -c -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada sdefault.adb gnatmake -c -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada gnatmake --GCC="gcc -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata" gcc -c -I./ -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata -I- /home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada/gnatmake.adb gcc -c -I./ -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata -I- /home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada/gnatvsn.adb gcc -c -I./ -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-gnu/4.4.3/adalib/ -I. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata -I- /home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada/make.adb make.adb:7489:07: "Create_Temp_Output_File" is undefined gnatmake: "/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada/make.adb" compilation error make[3]: *** [gnatmake-re] Error 4 make[3]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc/ada/tools' make[2]: *** [gnattools-cross] Error 2 make[2]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gnattools' make[1]: *** [all-gnattools] Error 2 make[1]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2' make: *** [all] Error 2 It's almost as if it should be building a native rts for gnattools. To get this far, I commented out the following from configure: #if test "${ENABLE_LIBADA}" != "yes" ; then # noconfigdirs="$noconfigdirs gnattools" #fi Which according to this http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19959#c14 is totally wrong and Arno's recommendation of using make -C gcc gnattools fails with: $ make -C gcc gnattools make: Entering directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc' make: *** No rule to make target `gnattools'. Stop. make: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc' Now, trying again with normal untouched source (i.e. the configure lines put back in) and then configured in the same way as above, but without the --disable-libada flag passed, fails as follows: test -f stamp-libada || \ make -C ../.././gcc/ada "MAKEOVERRIDES=" "LDFLAGS=" "LN_S=ln -s" "SHELL=/bin/sh" "GNATLIBFLAGS=-W -Wall -gnatpg " "GNATLIBCFLAGS=-g -O2 " "GNATLIBCFLA GS_FOR_C=-g -O2 -fno-inline -Wno-missing-prototypes -fexceptions -DIN_RTS -DHAVE_GETIPINFO " "TARGET_LIBGCC2_CFLAGS=-fno-inline -Wno-missing-prototypes" "THRE AD_KIND=native" "TRACE=no" "MULTISUBDIR=" "libsubdir=/opt/tamp-cross/lib/gcc/arm-none-eabi/4.5.2" "objext=.o" "prefix=/opt/tamp-cross" "exeext=.exeext.should. not.be.used " 'CC=the.host.compiler.should.not.be.needed' "GCC_FOR_TARGET=/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/./gcc/xgcc -B/home/l aguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/./gcc/ -B/opt/tamp-cross/arm-none-eabi/bin/ -B/opt/tamp-cross/arm-none-eabi/lib/ -isystem /opt/tamp-c ross/arm-none-eabi/include -isystem /opt/tamp-cross/arm-none-eabi/sys-include " "CFLAGS=-g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-protot ypes" gnatlib \ && touch stamp-libada make[3]: Entering directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc/ada' make -C rts \ CC="`echo \"/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/./gcc/xgcc -B/home/laguest/src/mine/tamp/thirdparty/build/arm-none -eabi/gcc2/./gcc/ -B/opt/tamp-cross/arm-none-eabi/bin/ -B/opt/tamp-cross/arm-none-eabi/lib/ -isystem /opt/tamp-cross/arm-none-eabi/include -isystem /opt/tamp- cross/arm-none-eabi/sys-include \" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B \./,-B../../,'`" \ INCLUDES="-I. -I.. -I../.. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5 .2/gcc/../include -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc -I./../.." \ CFLAGS="-g -O2 -fno-inline -Wno-missing-prototypes -fexceptions -DIN_RTS -DHAVE_GETIPINFO " \ FORCE_DEBUG_ADAFLAGS="-g" \ srcdir=/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc \ -f ../Makefile adadecode.o adaint.o argv.o cio.o cstreams.o ctrl_c.o errno.o exit.o env.o raise.o sysdep.o aux-io.o init.o initialize.o seh_in it.o cal.o arit64.o final.o tracebak.o expect.o mkdir.o socket.o targext.o make[4]: Entering directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc/ada/rts' /home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/./gcc/xgcc -B/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/./gcc/ -B/opt/tam p-cross/arm-none-eabi/bin/ -B/opt/tamp-cross/arm-none-eabi/lib/ -isystem /opt/tamp-cross/arm-none-eabi/include -isystem /opt/tamp-cross/arm-none-eabi/sys-incl ude -c -DCROSS_DIRECTORY_STRUCTURE -DIN_GCC `echo -g -O2 -fno-inline -Wno-missing-prototypes -fexceptions -DIN_RTS -DHAVE_GETIPINFO |sed -e 's/-pedantic/ /g' -e 's/-Wtraditional//g'` \ -I. -I.. -I../.. -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/ada -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc/../includ e -I/home/laguest/src/mine/tamp/thirdparty/src/gcc-4.5.2/gcc -I./../.. adadecode.c -o adadecode.o In file included from /opt/tamp-cross/arm-none-eabi/include/dirent.h:6:0, from adaint.h:39, from adadecode.c:45: /opt/tamp-cross/arm-none-eabi/include/sys/dirent.h:10:2: error: #error "<dirent.h> not supported" In file included from adadecode.c:45:0: adaint.h:137:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token adaint.h:138:57: error: expected ')' before '*' token adaint.h:139:57: error: expected ')' before '*' token make[4]: *** [adadecode.o] Error 1 make[4]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc/ada/rts' make[3]: *** [gnatlib] Error 2 make[3]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/gcc/ada' make[2]: *** [gnatlib-plain] Error 2 make[2]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2/arm-none-eabi/libada' make[1]: *** [all-target-libada] Error 2 make[1]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/arm-none-eabi/gcc2' make: *** [all] Error 2 Which is fairy enough as I don't have a C lib that supports dirent.h and I essentially, don't want a RTS as I'll be creating a minimal one outside of the GCC tree. Now, for completeness, if I configure the normal source with the --disable-libada flag, I can compile and build, but I do not get the gnattools, because they seem to be dependent on libgnat. Ideally, I'd like to be able to build what I need, there must be a way. Please don't tell me to look at how RTEMS or MarteOS does it, they don't help at all. I've already looked. Thanks, Luke.