r/ada • • 2d 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

8 Upvotes

7 comments sorted by

5

u/jordansrowles 2d ago

I'd recommend installing Alire first, then running alr toolchain --select to install GNAT and GPRbuild.

You can then create a project with alr init --bin hello, enter the directory and run alr run to build and execute it.

Once that's working, you can use alr edit to 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

1

u/DiligentBill2936 2d ago

Thanks. I see below error when running toolchain --select command.

curl failed to verify the legitimacy of the server and therefore could not

establish a secure connection to it. To learn more about this situation and

how to fix it, please visit the webpage mentioned above.

File not found - C:\Users\Admin\AppData\Local\alire\cache\toolchains\alr-6280-tyti.tmp\*

2

u/jordansrowles 2d ago

Someone else had a similar issue to you, https://forum.ada-lang.io/t/alire-really-curl-certificate-problem-on-windows/1683

Are you using an antivirus like Norton or Kaspersky? In their case it was interfering with cert verification

Do where curl and curl I https://github.com to see if you have it, and can connect with TLS

1

u/DiligentBill2936 2d ago

Yes. Using Kaspersky. Need to shutdown for some time then.

2

u/DiligentBill2936 2d ago

It worked. where is gnat and gprbuild are installed ? GNAT studio needs it.

2

u/DiligentBill2936 2d ago

OK. got it. Its at C:\Users\Admin\AppData\Local\alire\cache\toolchains\. Executables inside it must be in the PATH.

4

u/Dmitry-Kazakov 2d 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.