Ada Compiler (GNAT) Packages For Arch

I saw a post on the Arch Linux forums from a user wanting to build an Ada compiler and having issues with the PKGBUILD from the AUR. The main issue building the Ada compiler is that you need the Ada compiler to do it. Classic chicken and egg problem. The maintainer of the AUR package works around this by having the PKGBUILD download a tarball from his site that provides the necessary binaries to build the compiler. It is probably perfectly safe, but I would not be doing that… Also, according to the forum post, the binary compiler package seems slightly broken at the moment.

So I went on a mission to create some gcc-ada packages for Arch. I had some interesting problems along the way (you really should not try to compile on an x86_64 system with an i686 makepkg.conf…), but I succeeded in in the end. Get packages for i686 and x86_64 from here. Note that I provide the build files too, but remember you will need the package to build the package…

For those that are interested in how I bootstrapped this package (or do not trust my binaries), here are the details:

  • Create a build chroot (sudo mkarchroot /path/to/chroot base base-devel sudo)
  • Extract rpms from Fedora rawhide for gcc, libgnat, libgnat-devel and gcc-gnat into the chroot
  • In the chroot: cd /usr/bin && ln -s ../lib/gcc/i686-pc-linux-gnu/4.4.1/cc1 cc1
  • Comment out the makedepends and CC=gcc-ada lines in the PKGBUILD
  • Build the package (sudo makechrootpkg -c -r /path/to/chroot)
  • Revert the comments in the PKGBUILD, create a clean chroot, install the built gcc-ada package and rebuild

Then you end up with a nicely bootstrapped Ada compiler. Fedora packages were used as their tool-chain package versions are very similar to those in Arch and thus likely to actually work as drop-in replacements for our packages. Note that the last step is superlative given gcc bootstraps itself as part of its build process.

Edit: gcc-ada is now available from the Arch Linux repos.

2 thoughts on “Ada Compiler (GNAT) Packages For Arch

  1. Hi Allan,

    Glad to see you looked at this. It would be nice if GNAT was officially supported, and if gcc was split into gcc-java, gcc-objc, gcc-fortran… as it was before. I don’t remember why gcc is unsplit, but is it relevant now that pacman supports splitting?

    I’ve explained on AUR how I build my binaries for i686 & x86_64. In fact they are just the gcc-ada packages stripped. And I took the first packages from Frugalware.
    Actually, these binaries have to match with the installed gcc version. So they were not really broken, just out of date.

    What else.. I’ve excluded comments from the global sed. This is not only for cosmetic purposes, but to do not produce lines too long. According to Gentoo ebuild, the style check could fail.

    Ask me if needed, I would be pleased to help you.


  2. I am actually thinking of re-splitting the Arch gcc packages using the package splitting in makepkg. You can read about the reasons for joining them together here. If I re-split them, I will probably include the gcc-ada package, but that requires clearance from other devs.

    And your sed line was very helpful. I had tried just doing a “gcc” to “gcc-ada” sed without the exclusion and compilation failed because of a too long comment line… Stupid language, isn’t it?