Subject: bug#66017: Cannot install Ada mode

From: Left Right <[email-masked]>
Date: Sat, 23 Sep 2023 21:04:39 +0200

Sorry for making too much noise. Here's what I tried:

❯ alr printenv > alrenv
❯ . ./alrenv
❯ gprbuild -s "-j0" "-p" "-P"
"/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/depe
ndencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire.gpr"
gnatcoll.gpr:254:07: warning: value "windows" is not used as label
Compile
   [Ada]          wisitoken-followed_by.adb
   [Ada]          wisitoken_grammar_runtime.adb
wisitoken-followed_by.adb:222:07: warning: "Generate_Data" is not
modified, could be declared constant [-gnatwk]
wisitoken_grammar_runtime.adb:197:13: warning: unreachable code
[enabled by default]

   compilation of wisitoken_grammar_runtime.adb failed
   compilation of wisitoken-followed_by.adb failed

gprbuild: *** compilation phase failed

This seems to be the actual error.

On Sat, Sep 23, 2023 at 8:55 PM Left Right <[email-masked]> wrote:
>
> I tried to uninstall every other Ada-related package I installed from
> my distro packages, including Alire. Downloaded Alire binary afresh
> and used it to install the toolchain.
>
> So, I don't think that when I try to run gprbuild command I get the
> same output Alire gets when it runs it. It must be running it in some
> other environment. The thing is: I don't have *any* globally available
> gprbuild now. But the command Alire runs somehow exits with code 4,
> whereas if it couldn't find the command, it would have to exit with
> code 1. It fails for some other reason, but I cannot find a way to
> make the build more verbose so that it would print the stderr / stdout
> of the failing command.
>
> On Sat, Sep 23, 2023 at 6:28 PM Left Right <[email-masked]> wrote:
> >
> > > 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