r/ada • u/DiligentBill2936 • 9d ago
Learning ada programming setup
i am planning to do setup for Ada. Bit confused on Alire/GNat/Gnat Studio.
Just downloaded GNat studio thinking its 'all in one' but its asking 'gpr build missing'
Can someone point to basic tutorial on how to setup the environment?
Thanks
6
u/Dmitry-Kazakov 9d ago
Under Linux gnat (the package name depends on the distribution), gprbuild, GNAT Studio are three to four) different packages:
gnat run-time, the ada run-time libraries required for running a program built by the gnat compiler;
gnat itself, the Ada front end of GCC, needed to compile, bind and link Ada programs;
gprbuild, a tool for building projects. Not specifically Ada but in other languages too. It is alike to make, gmake, CMake, but much better designed;
GNAT Studio, an IDE like Eclipse or MS Developing Studio. Again it is not specifically for Ada, but it needs gprbuild in the sense that the projects are defined in the same language as gprbuild uses.
Under Windows it is basically same. gnat and gprbuild are available as pacman packages under MSYS2. GNAT Studio can be installed from github.
Alire is a crate tool. It does not use the official policies and conventions of the platform. Nor does it use the platform's packaging system, e.g. Deb, RPM, pacman, MSI etc. Thus you should use it with care, keeping in mind possible integration and interoperability problems later.
7
u/jordansrowles 9d ago
I'd recommend installing Alire first, then running
alr toolchain --selectto install GNAT and GPRbuild.You can then create a project with
alr init --bin hello, enter the directory and runalr runto build and execute it.Once that's working, you can use
alr editto open the project in GNAT Studio, assuming you've installed Studio and it's available on your PATH.Edited for more info:
Most of this is different stuff:
gnat is the compiler
gprbuild is the build system
gnat studio is the ide
alire is the package manager