Ada support in crosstool (was: Cross Compiling using modified crosstool-0.27.tar.gz)

Dan Kegel
Wed Oct 6 14:41:00 GMT 2004

Here's a few changes from Mark Fortescue that might be helpful
for people trying to use crosstool to build Ada.  I haven't
had time to incorporate them yet...
- Dan

-------- Original Message --------
Subject: Re: Cross Compiling using modified crosstool-0.27.tar.gz
Date: Wed, 22 Sep 2004 22:06:15 +0100 (BST)
From: Mark Fortescue <mark@mt...>
To: Dan Kegel <>

Hi Dan,

I do not know if my initfini.c optimisation modifications are in the glibc
cvs tree. I have never used cvs and I can't find any appropriate FAQs on

I have been having trouble with a canadian cross compile that has messed
up my build and target systems a number of times. I have now got fed up
with it and I am going to restart the exersize with gcc-2.8.1 as I have
used this sucsesfully in a canadian cross compile in the past. It did
require editing some errors out of the Makefile as BUILD and HOST tools
got mixed up in a number of areas.

The primary problem is the canadian cross compile of gcc-3.4.2 gets the
library build totally wrong and in the ada stuf, it uses the wrong
include/library paths. The configuraton has now become so involved that it
is going to take me weeks to figure out what is going on, let alown fix

The net result is that basically I have no working web brouser/news
system and I can not spend any more time sorting out the mess so I will
net be able to do any testing of the crosstools script in the near future.

In addition, the sparc kernel has some cg3 console bugs in it so
it does not work on my sparc1 hadware. I will have to compare what is
going on with my 2.2.14 kernel that does start up but currently has a
network problem to do with the NFS root so it hangs at the network auto
configuration stage. I can;t remember what I did to get round this last
time I was working on this.

For a straignt ADA cross compiler, the addition of the following to the (crosstool-0.28-rc36) script should so the trick. I have
sucsessfully build the test program on my i586 and run it on a powerpc.
The canadian cross is a problem. I can't even get a working C compiler out
of it at the moment.

This script fragment should go someware before the final GCC configure.
# MTF ADA Mod 1:
# Check for ADA in GCC_LANGUAGES as this requires extra operations
# GCC earlier than 3.4.x may require different options.
# See gcc INSTALL files.
# The test below assumes that the build system suports ADA
if `echo "${GCC_LANGUAGES}" | grep -sq ada`; then
     # Write a small test program to see if the ada compiler/tools work
     cat >adatest.adb <<EOF
WITH Ada.Text_IO;

BEGIN -- AdaTest

    Ada.Text_IO.Put (Item => "Hello Ada World.");

END AdaTest;
     if test -n "${CANADIAN_BUILD}"; then
	# I have assumed that gnat is OK as how else will you have created
	# the ADA cross compiler for ${TARGET}.
	if `${TARGET}-gnatmake -o adatest adatest.adb 2>/dev/null`; then
	    if test -x ./adatest; then
		# It built so we assume it will run on the target machine.
	if `gnatmake -o adatest adatest.adb 2>/dev/null`; then
	    if test -x ./adatest; then
		# It built so belt and braces, test it actualy works.
		if test "`./adatest`" = "Hello Ada World."; then
     rm -f adatest*
     if test "${do_ada_build}" != "yes"; then
	GCC_LANGUAGES=`echo "${GCC_LANGUAGES}" | grep -v ada`
	echo "ADA removed from languages as the build system compiler does
not support it."
# End of Mod 1
This script should go before the final GCC make install.
Ideally it sould check that the compilation of gnat worked before doing
the extar ada cross compiler bits.
It may need altering for canadian cross compilation as I have yet to get
that to work.
# MTF ADA Mod 2:
if test "${do_ada_build}" = "yes"; then
     cd gcc
     if test -z "`ls gnat1`"; then
	# Do we rearly want to abort. If ADA is esential, yes, otherwise
	# leave it till you have the time to sort out what went wrong.
	echo "************ ADA Compiler failed to build !!! ******************"
	echo "************ Skipping ADA Tools/library build ******************"
	# The notes state that only cross-gnattools is required for Canadian Builds.
	# The asumption is that host = target so you already have the libraries.
	# I have not got that far yet.
	make gnatlib cross-gnattools ada.all.cross
     cd ..
# End of Mod 2

I hope that these ramblings are of some use to you.

	Mark Fortescue.

My technical stuff:
My politics: see for examples of why I'm for regime change

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list