Learning Ada: Installing GNAT

By | July 23, 2012

This is part of a series on programming in the Ada language, a mission critical programming language that I am attempting to learn and become proficient in.

The standard compiler for the Ada language today is the GNAT compiler which is part of GCC. There are actually 3 different versions of GNAT: GNAT-GPL, GNAT Pro and GNAT-GCC. GNAT-GPL and GNAT-Pro are released by AdaCore, the company that develops Ada-related products. GNAT-GCC includes a runtime library licensed under the GPL requiring all binaries compiled by it to be released under the GPL. GNAT Pro and GNAT-GCC (included in the GCC distribution) includes a runtime under the GMGPL (GNAT Modified GPL), a license equivalent to the LGPL.

I decided to start off with GNAT-GPL, which includes an IDE (GNAT Programming Studio) then later switch the compiler to GNAT-GCC as needed. So I downloaded a copy of GNAT-GPL 2012 for x86 Windows from the Libre website of AdaCore and installed it. Note that although it shows a field for email before you download, you do not need to fill it in for the downloads to show.

At 108 MB, it was a pretty big download and took several minutes to download. The per-user installation went smoothly as I had expected and within a few more minutes, GNAT was successfully installed. Or so I had thought. The first logical step was to load up GNAT Programming Studio and take a look around the environment. The splash screen loaded and, for a few seconds, the program appeared to be loading, but when the splash screen closed, the program did not load. A peek at task manager shows that the gps.exe process quits after the splash screen exits so something must not have been right with the installation or my machine.

GPS Splash Screen

The splash screen loaded…a good sign. But when it closed, GNAT Programming Studio didn’t start.

I was not in the mood to debug the problem and just moved on to the second option: GNATbench. GNATbench is a plugin for Eclipse that turns it into a complete Ada development environment. This was another 57 MB to download. Naturally, I also needed Eclipse so I went and downloaded that as well — another 192 MB.

I followed the instructions in the readme for GNATbench and installed it through Help->Install New Software…except it wouldn’t install. It was missing a dependency. Rereading the readme said that I needed the C/C++ Development Tools so I installed that through the dialog — it didn’t say how many MB it was but I assume it was about 5 MB based on how long it took to install. I restarted Eclipse and tried installing GNATbench again — still with no luck. I went into the dialog again and installed everything having to do with C/C++ — probably another 10 MB of downloads. Once more, GNATbench failed to install.

ReadingĀ  the deceptively simple readme even more closely, it said that GNATbench needed Eclipse 3.6 or 3.7…hmm, what version do I have? Eclipse 4.2???!!!??? Apparently, Eclipse 4.2 Juno was only recently released this June and GNATbench had not been updated to support it. Eclipse 3.7 was the previous version as they skipped 3.8, 4.0 and 4.1 so at least I would only be 1 version behind so I went and downloaded Eclipse 3.7 Indigo — this time, the C/C++ version so I wouldn’t have to go through the trouble of installing them afterwards. It was another 114 MB to download but at long last, GNATbench was up and running.

So long story short, it took me 486 MB of downloads to get it working, but at least it works! Now if only this code will work…but that’s for next time.

8 thoughts on “Learning Ada: Installing GNAT

  1. Marc C

    These are not at all common problems when installing GNAT. If you do want to get back to seeing what the problem is, you can get some assistance on Stack Overflow or comp.lang.ada.

    Also, GPS is the most commonly used IDE for GNAT, so I’d hate to see you missing out on it.

    1. North Post author

      Yeah, I thought so…because I can’t find much information available on Google. There’s one on the AdaCore mailing list although it hasn’t received a response.

      I’ll go take another look at it later after I’ve gotten a bit more used to the language. And I probably will do that because GNATbench is giving me problems as well…it (well actually, the GNAT compiler) keeps telling me

      “An internal error occurred during: “loading construct database for “.
      key already in map

      every time a change is made to the project…or whenever it’s loaded (I’m guessing it’s reloaded when a change is made). That, and it randomly crashes. And sometimes, it makes it impossible to add newlines to the code requiring a restart.

      Besides the first one, these are currently rare enough to not be too annoying but I will be going over them again (or resolve the problem by using GPS itself) in a few weeks before they start making me go crazy.

      1. pavlos

        Did you find what is causing this “key already in map” error and any way to fix it?
        I am having the same and beside all the searches I couldn’t find any solution.

        1. North Post author

          I never found a solution to the problem. It works fine on my newer computer though so that’s what I’m using now. It might be an issue with Win XP getting too old. My best guess is that Microsoft released an update to Windows that broke GNAT sometime after I installed it and before I tried using it since it did work right after installation.

  2. Mr. DOS

    For the purpose of putting blame where blame is due, I would like to point out that from the fourth paragraph on, the problems are with Eclipse, and not necessarily specific to Ada. As much as the Eclipse Foundation tries to disguise it, third parties, for whatever reason, generally seem to play a months-long catch-up game after new major versions of Eclipse are released.

    1. North Post author

      I guess with the fact that its major version is being incremented, that catch-up will take even longer this time.

  3. SiN

    To add my voice to this issue.

    I have seen this same problem where GPS starts with a splash screen and then terminates.

    Starting from the commandline with the switch –debug provides no extra information, a running instance dgbview catches no signs of distress either.

    Starting the programme via gdb provides a little information:

    (gdb) run
    Starting program: C:\GNAT\2012\bin\gps.exe
    [New Thread 2396.0x64c]
    [Inferior 1 (process 2396) exited with code 01]


Leave a Reply

Your email address will not be published. Required fields are marked *