`alr --bin init` creates crates GPS can't make sense of?

I do the following, per the Alire Quickstart instructions:

alr init --bin my_proj
cd my_proj
alr build
alr run

Next I try to edit it:

alr edit

The most recent gnatstudio is in my path, so the editor pops up in the crate. Trouble is, it doesn’t seem to understand the project file at all. (Screenshot below.) To wit:

  • src has a source file in it, but the icon isn’t expandable.
  • While there are “build” and “run” buttons, they doesn’t actually build and run the program; rather, they seem good only for generating Uncaught Exceptions; see output below.
  • This is not a problem with pre-existing alire crates; it’s only a problem for anything I try to generate now.

Weirdly, this was working earlier today, which makes me think I broke something at some point. Does anyone have any suggestions for figuring out how to fix it?

Uncaught exception in workflows:
Traceback (most recent call last):
  File "/path/to/opt/gnatstudio/share/gnatstudio/support/ui/workflow_buttons.py", line 133, in build_main
    r0 = yield builder.wait_on_execute(main_name)
  File "/path/to/opt/gnatstudio/share/gnatstudio/support/ui/workflows/promises.py", line 1108, in wait_on_execute
    self.__target.execute(main_name=main_name,
  File "/path/to/opt/gnatstudio/share/gnatstudio/support/core/extensions/__init__.py", line 380, in execute
    self._internal_execute(
GPS.Unexpected_Exception: unexpected internal exception raised CONSTRAINT_ERROR : gnatcoll-projects.adb:5729 index check failed
[/path/to/opt/gnatstudio/bin/../lib/gnatstudio/libgnatcoll.so.23.0w]
0x7f1c6cc179c1 gnatcoll__projects__compute_scenario_variables__register_untyped_var.1798.constprop.0 at ???
0x7f1c6cc17d06 gnatcoll__projects__compute_scenario_variables__register_var.1778 at ???
0x7f1c6cc238c7 gnatcoll__projects__for_each_external_variable_declaration at ???
0x7f1c6cc26235 gnatcoll__projects__compute_scenario_variables at ???
0x7f1c6cc271aa gnatcoll__projects__scenario_variables__3.part.0 at ???
0x7f1c6cc27319 gnatcoll__projects__scenario_variables at ???
[/path/to/opt/gnatstudio/bin/gnatstudio_exe]
0x3cdd374

…and after that, a bunch more hexadecimal numbers and suchnot.

Here’s an interesting update: if I modify the new crate’s alire.toml to depend on a local crate, alr edit has no trouble recognizing the project… even though the new crate doesn’t depend on the older crate…

Further update: Also works if I add any dependency at all. But:

  • [[depends-on]] without listing a dependency, or
  • not having [[depends-on]] at all:

means it’s broken.

What version of Alire and GNAT Studio are you using?

alr 1.2.0-dev and GNAT Studio 23.0w (20220512) hosted on x86_64-pc-linux-gnu

OK, updating to 1.3.0-dev fixes the issue, but I cannot update alire using alire itself; I had to re-download the repository (or the binary, I suppose). When I try alr build from within the alire folder, I get the following:

alr build
warn: Generating possibly incomplete configuration because of missing dependencies
warn: Generating possibly incomplete environment because of missing dependencies
ⓘ ansiada^1.0: no build needed.
ⓘ minirest~0.2: no build needed.
ⓘ uri_ada^2.0: no build needed.
ⓘ Building xml_ez_out/xml_ez_out.gpr...
Bind
   [gprbind]      tmeztf.bexch
   [Ada]          tmeztf.ali
Link
   [link]         tmeztf.adb
ⓘ Building alr/alr.gpr...
alr.gpr:8:06: imported project file "uri_ada" not found
alire.gpr:5:06: imported project file "ansiada" not found
alire.gpr:5:06: imported by "/path/to/alire/alire.gpr"
alire.gpr:5:06: imported by "/path/to/alire/alr.gpr"
alire.gpr:8:06: imported project file "minirest" not found
alire.gpr:8:06: imported by "/path/to/alire/alire.gpr"
alire.gpr:8:06: imported by "/path/to/alire/alr.gpr"
alire.gpr:16:06: imported project file "uri_ada" not found
alire.gpr:16:06: imported by "/path/to/alire/alire.gpr"
alire.gpr:16:06: imported by "/path/to/alire/alr.gpr"
gprbuild: "/path/to/alire/alr.gpr" processing failed
error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/path/to/alire/alr.gpr"] exited with code 4
error: Compilation failed.

This happened with both 1.2-dev and 1.3-dev. alr update doesn’t find a solution. It looks as if something goes wrong with the pinning stage, since alr pin gives (successful pins omitted):

Dependencies automatically updated as follows:                           

   New solution is incomplete.
   +⚠ ansiada             ^1.0      (new,missing:unavailable)
   +⚠ uri_ada             ^2.0      (new,missing:unavailable)
warn: Generating possibly incomplete environment because of missing dependencies
warn: Generating possibly incomplete configuration because of missing dependencies

If you want to build from sources and for some reason alr build is not working, you can use gprbuild -P alr_env.gpr and that should always succeed (we check both methods in our CI but the latter is the primary means of building alr for now.)

1 Like