public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gnattools cannot be built for freestanding/bare metal environment without hacking up the build machinery
@ 2014-01-16 17:53 Luke A. Guest
  2014-01-16 18:13 ` Rolf Ebert
  2014-02-14 12:20 ` Brian Drummond
  0 siblings, 2 replies; 8+ messages in thread
From: Luke A. Guest @ 2014-01-16 17:53 UTC (permalink / raw)
  To: GCC ML

Hi,

I've been over this before and have got nowhere with it. As I've just
retried building the latest sources after a long break I'd thought I'd
add some further comment in the hope that someone somewhere cares enough
to fix this issue; this is over my head at this time.

Say you want to build an Ada compiler for embedded work, small
SBC/micro's/osdev/whatever, you will want to set target to <arch>-elf or
similar. You can do this, to a point. You can configure the build as:

../../../source/gcc-git-ro/configure --prefix=/home/laguest/opt/tinyada
--target=arm-none-eabi --enable-interwork --enable-multilib
--without-headers --disable-nls --disable-shared --disable-threads
--disable-lto --with-gnu-as --with-gnu-ld --enable-languages=c,ada
--disable-libssp --disable-cloog-version-check
--disable-isl-version-check --with-gmp=/home/laguest/opt/tinyada
--with-mpfr=/home/laguest/opt/tinyada
--with-mpc=/home/laguest/opt/tinyada
--with-isl=/home/laguest/opt/tinyada
--with-cloog=/home/laguest/opt/tinyada

You can build it with "make all-gcc" and install with "make install-gcc"
and you get a gnat1 and <target>-gnatbind, this is fine, you can use the
system tools, gnatmake, etc. along with these tools - I have done this
before.

But what about the gnattools? Not buildable. A message in the ml
archives states to build them with "make -C gcc gnattools," but this
fails:

make: Entering directory
`/home/laguest/src/mine/tinyada-new/build/arm-none-eabi/gcc2-built-with-git-ro/gcc'
make -C ada CC="gcc" CXX="g++" "ADA_CFLAGS=" "BISON=bison" "BISONFLAGS="
"CFLAGS=-g " "LDFLAGS=-static-libstdc++ -static-libgcc " "FLEX=flex"
"FLEXFLAGS=" "LN=ln" "LN_S=ln -s" "MAKEINFO=makeinfo
--split-size=5000000" "MAKEINFOFLAGS=--no-split" "MAKEOVERRIDES="
"SHELL=/bin/sh" "exeext=" "build_exeext=" "objext=.o"
"exec_prefix=/home/laguest/opt/tinyada"
"prefix=/home/laguest/opt/tinyada" "local_prefix=/usr/local"
"gxx_include_dir=/home/laguest/opt/tinyada/lib/gcc/arm-none-eabi/4.9.0/../../../../arm-none-eabi/include/c++/4.9.0" "build_tooldir=/home/laguest/opt/tinyada/arm-none-eabi" "gcc_tooldir=/home/laguest/opt/tinyada/lib/gcc/arm-none-eabi/4.9.0/../../../../arm-none-eabi" "bindir=/home/laguest/opt/tinyada/bin" "libexecsubdir=/home/laguest/opt/tinyada/libexec/gcc/arm-none-eabi/4.9.0" "datarootdir=/home/laguest/opt/tinyada/share" "datadir=/home/laguest/opt/tinyada/share" "localedir=/home/laguest/opt/tinyada/share/locale" "ADA_FOR_BUILD=" "ADA_INCLUDE_DIR=/home/laguest/opt/tinyada/lib/gcc/arm-none-eabi/4.9.0/adainclude" "ADA_RTL_OBJ_DIR=/home/laguest/opt/tinyada/lib/gcc/arm-none-eabi/4.9.0/adalib" "ADAFLAGS=-gnatpg -gnatwns -W -Wall" "ADA_FOR_TARGET=" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" ADA_INCLUDES="-I/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adalib/../adainclude -I/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adalib/" GNATMAKE="gnatmake" GNATBIND="gnatbind" GNATLINK="gnatlink" LIBGNAT="" gnattools1
make[1]: Entering directory
`/home/laguest/src/mine/tinyada-new/build/arm-none-eabi/gcc2-built-with-git-ro/gcc/ada'
touch ../stamp-tools
You must first build the GNAT library: make gnatlib
make[1]: *** [../stamp-gnatlib-rts] Error 1
make[1]: Leaving directory
`/home/laguest/src/mine/tinyada-new/build/arm-none-eabi/gcc2-built-with-git-ro/gcc/ada'
make: *** [gnattools] Error 2
make: Leaving directory
`/home/laguest/src/mine/tinyada-new/build/arm-none-eabi/gcc2-built-with-git-ro/gcc'

You can't disable libada using the command line as that also disables
gnattools - I don't know the reason for requiring this behaviour.

So there are 3 ways to get this work:

1) Do what AVR-Ada (and MSP430 as they use the same patch) to knock out
the dependency of libada on gnattools, from configure:

if test "${ENABLE_LIBADA}" != "yes" ; then
  noconfigdirs="$noconfigdirs"
fi

This then breaks normal builds, i.e. hosted, so you can use the same
sources reliably to build a new host compiler and the cross compiler(s).

2) Do as shown above to get gnat1 and <target>-gnatbind and use these
through the host's system tools.

3) Patch the source up to build a custom and pointless RTS that will
just take up disk space and never get used as the user will be
implementing their own. Currently, I'm getting a bug box on my patches
for arm-none-eabi.

Given that the C compiler can be build for a freestanding environment,
as can the C++ compiler and I'm betting some of the others can too, I
can't see why the Ada compiler can't as it is supported, at least in the
source, just not in the build infrastructure.

The following (or similar) will need to be added to gnattools/configure
to enable this kind of build (under the "Per-target case statement"):

  *-*-elf* | *-*-eabi*)
    TOOLS_TARGET_PAIRS="\
    mlib-tgt-specific.adb<mlib-tgt-specific-xi.adb"
    ;;

Also, the above is still in the main makefile as well which causes a lot
of confusion and should be removed from there.

I am aware that "freestanding" is actually a C standard term and not
applicable to Ada, but this is figurative only. GNAT's equivalent term
is Zero Foot Print (ZFP).

I think that we need a configure flag to disable libada and not
gnattools for these bare board targets.

Thanks,
Luke.


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

end of thread, other threads:[~2014-02-20 15:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-16 17:53 gnattools cannot be built for freestanding/bare metal environment without hacking up the build machinery Luke A. Guest
2014-01-16 18:13 ` Rolf Ebert
2014-01-16 18:23   ` Luke A. Guest
2014-01-16 22:49     ` Luke A. Guest
2014-02-14 12:20 ` Brian Drummond
2014-02-14 14:01   ` Luke A. Guest
     [not found]     ` <1392391977.17088.50.camel@Gannet.Four>
2014-02-14 15:42       ` Luke A. Guest
2014-02-20 15:47   ` 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).