These instructions are for installing and starting programming using AdaCore's faulty "GNAT Studio 2021" (hopefully they might have fixed it but I doubt it) on a 64bit computer with a Linux Fedora 37 operating system.
There are alternatives for AdaCore's "GNAT Studio".
These instructions have been tested on a computer with a fresh operating system installation WITH updates on 16 Feb 2023, of;
The computer has;
It is expected that the instructions here will work on a far lower specification machine.
The text editor that comes as default is Pluma and this was used.
Text written by the computer is shown in
[john@silver ~]$
Text you should type at the prompt is shown in
Other computer code such as programs are shown in this style
.
BEFORE YOU INSTALL "GNAT Studio" YOU MUST have "GNAT" installed. Follow the "GNAT Installation process" to be fount on the Start in GNAT page, if you don't have GNAT installed already, and then return here.
Download the files for "x86 GNU Linux (64 bits)", the "readme.txt", and "gnat-2021-20210519-x86_64-linux-bin" from AdaCore;
https://www.adacore.com/download
this is about 700 Gigabytes. Note that there are also GNAT Studio versions for many other operating systems that can be found from the link "More packages, platforms, versions and sources" on the bottom right of the downloads page.
It is possible they will have updated the installation file "gnat-2021-20210519-x86_64-linux-bin" and it will have been replaced by a similarly named file. If so then replace the references below to the original file name with the new file name when executing your commands.
Unfortunately the "readme.txt" file is not clear and also contains errors. It describes installation for Windows, Linux and Mac in a single file and omits certain crucial details that can corrupt the installation!
My installation was with a freshly installed Linux Fedora 37 operating system.
or the install process will work improperly. This year the installation was fine at this stage.
/opt/GNAT/2021/bin/gps_exe: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
Despite various problems, AdaCore have, and continue to provide GNAT Studio for free to non-commercial bodies, which must be appreciated. Thank you AdaCore.
You should be aware that GNAT Studio is not free when using it for the development of commercial software products and you should talk to them about buying a licence. For this you will receive their support service.
You can however develop commercial products using GNAT without GNAT Studio. See Starting GNAT but you lose the benefit of a good tool.
Move the file "gnat-2021-20210519-x86_64-linux-bin" into your home directory.
Open a terminal and make sure the file is executable with the command;
[john@silver ~]$ chmod +x gnat-2021-20210519-x86_64-linux-bin
Then install with the command;
[john@silver ~]$ sudo ./gnat-2021-20210519-x86_64-linux-bin
A dialogue window opens, accept the default options and work through to the "Finish". The GNAT Studio installation is complete.
There is always something. I found that my programs compiled OK but would not link! It took me 2 days and nights to solve this "little problem" with these instruction;
[john@silver ~]$ cd /opt/GNAT/2021/libexec/gcc/x86_64-pc-linux-gnu
[john@silver ~]$ ls
10.3.1
the command
[john@silver x86_64-pc-linux-gnu]$ cd 10.3.1
Where the 10.3.1 is replaced with your three numbers.
This is a directory structure installed as part of GNAT Studio and in it, it provides the command ld
which is the link command. We will find out about linkers later on. GNAT Studio replaces Fedora 37's version of ld with it's own one that DOESN'T work and generates nasty errors. So what do we need to do? We get rid of it by renaming it with;
[john@silver 10.3.1]$ sudo mv ld ldOLD
Once this is done a call to use ld
ends up using Fedora's version of the command which works. Having sorted that out, let's continue. (Two days wasted!)
It is convenient to set up a working folder for all your Ada programming with the following path;
~/prog/ada
You can do it with the folloing commands;
[john@silver ~]$ mkdir prog
[john@silver ~]$ mkdir prog/ada
I recommend that you set up the following executable script called "ada
" in your home folder.
Further instructions will assume that is what you have chosen to do;
cd prog/ada
export PATH=/opt/GNAT/2021/bin:$PATH
gnatstudio
so when you login in the morning you just type;
[john@silver ~]$ ./ada
at the
You can use your text editor to create the file and save it in your home directory. Then make it executable with;
[john@silver ~]$ chmod +x ada
Note that the script modifies the system PATH variable non-permanently. DO NOT modify the system path variable permanently otherwise when developing in other languages you find the IDEs and other programs looking in the folders that belong to GNAT before they look in their own folders, and then they often find the wrong things in unpredictable ways.
You may want to change the font styles. On the Edit menu click "Preferences", in the preferences window select "General" then click "Custom Styles".
in the preferences window select "Editor" then click "Fonts & Colors".
AdaCore provide a pretty good GNAT Studio Tutorial" but it had some errors at the time I used it but hopefully those have been corrected now. I submitted this Feedback on 2020-02-26.
At some point I may take the time to write a "hello world" program or provide other material for the AdaCore GNAT Studio, but since there is a lot already out there there seems little point. I have documented this installation process because decent installation documentation was missing. I hope AdaCore will correct this oversight. Ada is a high quality language and that quality should be made apparent from the very start!
Normally when there is an error on compiling the program, GNAT Studio gives you a link to click and it opens the editor with the error highlighted. Twice this functionality simply stopped working although it would compile and link and give files and line numbers there were no links.
After some investigation and working together with chat gpt we discovered that the problem was related to the hidden directory ".gnatstudio" in my home directory. It then turned out to be this line "<pref name="Messages-Line-Regexp-Index" > 1</pref>" in the file properties.xml which is in ".gnatstudio". Removing the line fixed the problem!
Another way to fix this is rename .gnatstudio to something like .gnatstudioBADVERSION and next time GNAT Studio starts it will generate a new clean .gnatstudio but then you will have to change the styles again. See above.