Installing Alire on Linux (xubuntu) as a noob

Hey there guys, I recently purchased a copy of the third edition of Ada 95 in an attempt to learn programming.

I came across Alire as a compiler for Ada 95 and I had a ton of trouble installing it on Xubuntu.
-I am pretty new to linux and the most i’m capable of is file exploring in the terminal.

I downloaded the linux version of Alire and extracted it. Heres what i ran in the terminal:
export PATH=“<PATH_TO_EXTRACTED>/bin/:$PATH”
export PATH=“<home/dirgo/Downloads/bin/alr>/bin/:$PATH”
export PATH=“<home/dirgo/Downloads/bin/:$PATH”
export PATH=“<home/dirgo/Downloads/bin/alr:$PATH”

After running each of these commands and typing alr in terminal, I received command not found. I’m sure I was running the command wrong, anyone know what the right way to type it was?

After failing with the export path command and searching on the internet for a few hours, I then stumbled across a video on youtube called “Ada for Game Developers: Installation and Setup”
-in the video, the dude mentioned routing the alr file to his path with:
sudo cp alr ‘your path here’
-his was /home/Andrew/.local/bin so sudo cp alr /home/Andrew/.local/bin
–this did not work for me when i typed sudo cp alr /home/dirgo/.local/bin
typing alr in the terminal would not show alr commands, it would continue to show command not found.

I then started typing cd (two periods) to get to the root directory (not sure why I started doing this, probably out of desperation) and then running ls to see what was located in the root directory.

  • I then spotted a magical directory called bin…
    – I opened bin with cd /bin and then viewed the contents with ls and that was when i saw what looked like a ton of terminal commands.

I then thought… what if I copy the alr file to the bin directory? IT WORKED!
I ran sudo cp alr /bin
-then ran alr and BANG

Hi Dirgo,
it’s not the right place to answer a Linux question, but you have moved alr in the /bin directory, that is supposed to be managed by the OS (apt package manager or a front end like for example synaptic…)
It’s probably better to install it in your home (/home/dirgo/bin or /home/dirgo/.local/bin, like Andrew), and to add this dir to your PATH.

Anyhow, you’ve done it, it works, so let’s go!
Two points :

  1. Ada 95 is pretty old now, start with your book, but keep in mind that you may find on the net many examples that uses a more recent version of the language.
  2. alr is not a compiler, it’s a lib manager, but it it will also install a compiler for you with alr toolchain --select

Welcome in the Ada world.

2 Likes

Why do not you just install Ada compiler by conventional means? E.g.

apt install gnat-12

You do not need an older compiler to force Ada 95. E.g.

gnatmake -gnat95 hello_world.adb

should do it.

Very nice, thank you. I’ve had some trouble with gnat documentation!

Haha yes, thank you! I’ve noticed differences already with the examples in the book and code I’ve seen online.

  • the code examples in the book have keywords in all caps which confused me at first, but I found out after that it’s for readability

After I spent a few months working with Ada, with handwritten GPR and GNATstudio I was about to leave it behind when I decided to try Alire (this was around the original 1.0 release time).

With Alire everything just works out of the box the same way on Windows and Linux with alr init --bin myproject, and now it even manages toolchains. The Alire team also significantly simplified working with multiple platforms and does a good enough job to not make me dive headfirst into GPR docs like I originally did.

Alire significantly lowers barrier to entry into Ada since you don’t have to worry about GPR at all to get up and running. You get progressive disclosure into the details of how everything works instead of diving headfirst into the GPR manual on top of trying to learn Ada.

2 Likes

I prefer the standard toolchain. I always create GPR files manually. It is quite easy and you need it anyway for any serious project. I appreciate GPR very much for its power, flexibility and full control. Compared to cmake and make GPR is great. I have projects with multiple targets some cross compiled, some remotely. GPR is really indispensable to me. I generally distaste any automated tools. Persistent posts “how do I clean up Alire” are indicative. Nobody asks how do I clean my GPR file! :sunglasses:

To be completely candid from my own experience, it’s probably because they quit after seeing the GPR docs and just switched to Rust or another language instead.

1 Like

I doubt it much. I tried Rust. It is completely unreadable and its crate system prevents building anything. There is always something missing. GPR gives me full control. Imagine, I can even work off-line!

If you do not like GPR, gcc -c is your friend… :sunglasses:

I do not buy such arguments. I perfectly remember claims that necessity of

with Text_IO;

killed Ada 83. If people cannot pass this test, they are no big loss anyway. Basic and Excel awaits them…