Subject: Re: bug#66017: Cannot install Ada mode

From: Left Right <[email-masked]>
Date: Sat, 23 Sep 2023 18:28:19 +0200

> Run "alr toolchain", select the internal Ada compiler.

Only the external compiler had ever been installed. If I run (I never
ran this before):

❯ alr toolchain
CRATE         VERSION STATUS  NOTES
gnat_external 13.2.1  Default Detected at /usr/bin/gnat

This is what I get.

Here's what I did afterwards:

1. Installed "gnat_native".
2. Ran `alr toolchain --select` and interactively selected a version
of "gnat_native" and "gprbuild" so that it looks like this:

❯ alr toolchain
CRATE         VERSION STATUS    NOTES
gprbuild      22.0.1  Default
gnat_native   13.1.0  Default
gnat_external 13.2.1  Available Detected at /usr/bin/gnat

Afterwards, I re-ran build.sh, and I get the same (?) error:

wisitoken-followed_by.adb:222:07: warning: "Generate_Data" is not
modified, could be declared constant [-gnatwk]
gnatcoll-projects.adb:38:09: warning: unit "Ada.Unchecked_Conversion"
is not referenced [-gnatwu]

   compilation of wisitoken-followed_by.adb failed

gprbuild: *** compilation phase failed
error: Command ["gprbuild", "-s", "-j0", "-p", "-P",
"/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire.gpr"]
exited with code 4
error: Compilation failed.

And if I re-run the failed command:

❯ gprbuild -s "-j0" "-p" "-P"
"/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire.gpr"
wisitoken_alire.gpr:8:06: imported project file
"standard_common_alire" not found
wisitoken_alire.gpr:28:43: unknown package or project "Standard_Common_Alire"
wisitoken_alire.gpr:28:43: wrong expression kind for attribute
"default_switches"
wisitoken_alire.gpr:28:84: unknown package or project "Standard_Common_Alire"
wisitoken_alire.gpr:31:43: unknown package or project "Standard_Common_Alire"
wisitoken_alire.gpr:31:43: wrong expression kind for attribute
"default_switches"
wisitoken_alire.gpr:31:82: unknown package or project "Standard_Common_Alire"
wisitoken_alire.gpr:35:41: unknown package or project "Standard_Common_Alire"
wisitoken_config.gpr:3:06: imported project file
"stephes_ada_library.gpr" not found
wisitoken_config.gpr:3:06: imported by
"/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/config/wisitoken_config.gpr"
wisitoken_config.gpr:3:06: imported by
"/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire.gpr"
gprbuild: "/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire.gpr"
processing failed

But when I run:

❯ gprbuild --version
GPRBUILD Pro 24.0w (20230430) (x86_64-pc-linux-gnu)
Copyright (C) 2004-2023, AdaCore
This is free software; see the source for copying conditions.
See your AdaCore support agreement for details of warranty and support.
If you do not have a current support agreement, then there is absolutely
no warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

So, it looks like maybe the version I selected through Alire is ignored?

Should I perhaps uninstall distribution-installed Ada-related packages
and re-try with only Alire-installed ones?

Thanks!

Oleg

On Fri, Sep 22, 2023 at 4:29 PM Stephen Leake
<[email-masked]> wrote:
>
> Left Right <[email-masked]> writes:
>
> > Hello Stephen, you wrote:
> >
> >> This indicates you are using a compiler external to Alire, with a newer version
> >> than the internal one; I only test with Alire internal compilers, for
> >> consistency.
> >
> >> Please configure the internal Alire compiler.
> >
> >> I will add the tested Alire version to the documentation.
> >
> > I don't know what to do with Alire, but I will try to figure out.
>
> Run "alr toolchain", select the internal Ada compiler.
>
> > But please consider that anyone trying to install Ada on Linux will
> > firstly try to go through the process recommended by the distro
> > maintainers.
>
> Alire is supposed to replace that process, but it's not quite there yet.
>
> > In my case, it's a combination of using pacman to install gcc-ada and
> > AUR (auxiliary packages not directly maintained by Arch distribution)
> > to install gprbuild, adaxml, alire etc. All I've done so far to
> > install Ada was to install packages from these sources.
> > (Unfortunately, both documentation and execution here are lacking, and
> > the process is quite complicated and error-prone).
>
> Apparently this ended up with Alire being configured for the external
> distro Ada compiler, rather than the internal one. That should not
> happen by default; perhaps you ran "alr toolchain" at some point?
>
> > It seems like you want me to install what gcc-ada would install, but
> > through Alire.
>
> No, just use the default compiler provided by the default Alire installation.
>
> > Am I right? In other words, something that isn't provided and managed
> > by the Linux distribution I'm using. This seems like a process that
> > requires a lot more expertise from an average user (building any GCC
> > compiler is not an easy task). Why is this the prefered choice of
> > environment?
>
> It is supposed to require less expertise. Unfortunately, when it fails, it
> is confusing and hard to diagnose.
>
> Part of the reason to start using Alire is to avoid version conflicts
> like this! Apparently that doesn't really work. Sigh.
>
> > As for the documentation: it seems we are reading two different
> > documentations. Is the one you are referring to available online?
> >
> > I was reading this:
> >
> https://www.gnu.org/software/emacs/manual/html_mono/ada-mode.html#Installation
>
> Sigh. That document is dated 2019 (see the Top node). The upstream
> source has been updated since then.
>
> > This documentation has no mention of how to build Ada mode, nor
> > anything about how Ada compiler and toolchain are meant to be set up
> > etc.
>
> The current version refers to ELPA.
>
> --
> -- Stephe