From Gentoo Wiki
Jump to: navigation, search
Gentoo Resources for Ada
Description This project provides support for Ada compilers and libraries in Portage. At present a gnat compiler is provided: gnat-gpl by AdaCore.
Project email
IRC channel #ada
No lead election date set
(and inherited member(s))
Parent Project Gentoo Linux
Project listing

Aim of the project

The project maintains the compiler, builder, system library and IDE for ada.

The spark language, based on ada and aimed at safety and security, is also supported.

The reference sources are the one present in the site, maintained by AdaCore.

We also hope to integrate gnat-gcc with the standard toolchain packages starting with 6.x/7.x, with new arches added as new bootstraps become available (see the ada-overlay on github for the current packages/eclass).

Current packages

At present

packages are part of the project.


Two compilers are available - for both x86 32 and 64 bits

  • dev-lang/gnat-gpl-2016 slotted 4.9.4
  • dev-lang/gnat-gpl-2017 slotted 6.3.0.

Each dev-lang/gnat-gpl compiler conflict with the sys-devel/gcc on the same slot.

dev-lang/gnat-gpl share in fact most of the sources and the binaries with gcc.

Before building the compiler you need to indicate the

  • the ADA compiler used to build the Ada compiler (if available)
  • the ADA compiler FLAGS, used to build Ada packages
  • optionally the nostrip features (or splitdebug) to retains symbol in the gnat runtime (e.g. catch exception with debugger)

The ADA variable is the name of the gcc compiler that can compile ada files and that will be used to build the ada compiler. If you do not specify the ADA variable, the system gcc compiler will be used instead, if capable.

Those should be set in the file etc/portage/make.conf (examples are for 64 bits)

FILE /etc/portage/make.confADA setting

To build the compiler unfortunately you need an ada/c/c++ compiler already available, to produce an ada/c/c++ compiler.

If you don't have an ada compiler available you must set the bootstrap use flags. In this case the compiler used will be gnat-gpl-2014-x86_64-linux-bin.tar.gz from

root # USE=bootstrap emerge dev-lang/gnat-gpl

Once installed you can use the compiler either

  • by selecting it with gcc-config. In this case you also change the default c/c++ compiler (and this is not supported to upgrade gentoo)
  • by postfixing any ada command with its own version: eg. gnatmake-4.9.4

Building the dev-ada packages

As is too risky to use as the system c/c++ compiler the gnat-gpl compiler, you need to indicate which of the two version of compilers to use by setting one, and only one of the two use flags:

  • gnat_2016 to select dev-lang/gnat-gpl-2016
  • gnat_2017 to select dev-lang/gnat-gpl-2017

This will be used to build all the dev-ada/ada packages.

Those should be set in the file etc/portage/make.conf

FILE /etc/portage/make.confADA setting
USE="gnat_2016 ..."

The packages, like dev-ada/gprbuild, have a default use flag set for gnat_2016 or gnat_2017, depending of the version of it.

when the default conflict with the global value use something like:

FILE /etc/portage/package.usegnat setting
dev-ada/gprbuild -gnat2017

to build for instance =dev-ada/gprbuild-2017 with the 2016 compiler.

There is no need for updating package.use when building the 2017 version gprbuild with the 2017 version of gnat-gpl compiler. The same apply for the 2016 versions of the respective packages.

Compiler changes

When you want to use a new ada compiler you need to change the make.conf to reflect this choice

FILE /etc/portage/make.confADA setting
USE="gnat_2017 ..."

i.e. change the use flag setting, enabling gnat_2017 and disabling gnat_2016 and then rebuild all ada packages