alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
278 stars 49 forks source link

Toolchain install guidance for new Ada users #1192

Closed TamaMcGlinn closed 1 year ago

TamaMcGlinn commented 2 years ago

It would be good to have some clear guidance on the main alire page, as to how GNAT should be installed.

In the past, the recommended way was to install GNAT by running the AdaCore gnat installer downloaded from adacore.com/download. That still works if you key in the url yourself, but the link to that from their website has been replaced with a message saying to use Alire instead; hence new users will come to alire confused as to how to get a basic gprbuild-based project compiled.

The new way, I think, is something like:

alr toolchain --select

and then adding some directory created by alire to your PATH. For alire projects this is of course not necessary, but for example learn.adacore.com allows you to download simple gprbuild based projects, so it is nice if we can allow gprbuild to just work.

TamaMcGlinn commented 2 years ago

In my case, I did:

find ~/.config/alire/cache/ -type d -iname bin

and selected a gprbuild and a gnat_native directory to add to my path (I am using bash_path_funcs) by adding to my ~/.bashrc:

addpath -p PATH $HOME/.config/alire/cache/dependencies/gprbuild_22.0.1_24dfc1b5/bin
addpath -p PATH $HOME/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/bin
mosteo commented 2 years ago

Yes, we could make default toolchains more accessible with e.g. alr printenv --toolchain. Although, for pure non-alire use, one can always install in a preferred location with alr toolchain --install-dir.

0rzech commented 1 year ago

Couldn't we have $HOME/.config/alire/cache/bin directory containing symlinks to default gprbuild and gnat binaries? This would make it easy to just export PATH=${HOME}/.config/alire/cache/bin:${PATH} and have the latest defaults in PATH automatically.

Fabien-Chouteau commented 1 year ago

In my opinion, it's important to keep in mind that the goal of Alire is not to become an installer for GNAT and gprbuild. And I don't think it is good to add more complexity to Alire's code and interface for workflows that want to use Alire only as a way to download a toolchain. The current solution is already confusing to many users.

I can see this changing in the a 2.0 release where we would remove the toolchain sub-command and have a built-in implicit dependency on gnat and gprbuild for every crate. If there is no constraints on GNAT/gprbuild version the latest are used. We can still keep a user option to not use the Alire provided toolchains, but that's a corner case IMO.

Now on the other hand, we are still trying to find the right balance for the alr install. This can be a solution to provide what you want, not as a special feature but as one way of using a standard feature.

$ alr install gnat_native --prefix=${HOME}/opt/
mosteo commented 1 year ago

I pretty much agree with Fabien here, and I hope to have another go at alr install soon that will remove the remaining hurdles, so I'm closing this issue.