Issue with GNAT Studio Community and Alire

Apologies if this has been asked before but I couldn’t find any relevant answers in this forum.

I’ve used Alire to create the hello-world project (i.e. alr get hello) and then tried to open that project using the GNAT Studio Community (which I’ve grabbed from https://github.com/AdaCore/gnatstudio/releases) but no source files are showing in the Project tab on the left-hand side and when I try building the project I’m getting:

[2024-09-19 22:02:17] Could not determine the project for file: /home/savvas/Coding/Tmp/hello_1.0.1_dcc36a2f/hello.gpr
[2024-09-19 22:02:17] Could not expand argument in command line: %fp
[2024-09-19 22:02:17] Build command not launched.

The same happens when I try to migrate an existing project to Alire using: alr init --in-place --bin my_crate except that in this case the source files are showing.

I’m using the latest executable for GNAT Studio and running alr --version reports alr 2.0.1.

Any suggestions would be much appreciated.

Thank you.

Are you using alr edit inside your crate directory to launch GNAT Studio? Also is GNAT Studio in your path?

Ok, adding Gnat Studio in the path and using alr edit fixed the missing sources issue, thank you. However, when I run a build from within GNAT Studio I am getting:

No file selected
Could not expand argument in command line: %fp
Build command not launched.

When I click Build & Run I am getting:

alr --non-interactive --no-color --no-tty -q build --
ERROR: creation of new directory "/tmp/.mount_gnatstzHbMLC/usr/etc/alire" failed
ERROR: alr encountered an unexpected error, re-run with -d for details.
ERROR: error location: 0xf24272 Gnatcoll.Vfs.Make_Dir at gnatcoll-vfs.adb:1566

Running alr build (and alr run) on the command line works fine.

Could this be some permissions issue?

After downloading the latest GNAT Studio I am also getting the Could not expand argument in command line: %fp error in other non-Alirefied projects too so I am wondering if this is a red-herring and is rather an issue with the latest GNAT Studio build. :thinking:

…also, not sure if that’s relevant but when I run a command like:
alr -d search --full --external-detect gnat_

I am getting the following error:

stderr: SEMANTIC_VERSIONING.MALFORMED_INPUT                                                 
stderr: Empty point number
stderr: raised SEMANTIC_VERSIONING.MALFORMED_INPUT : Empty point number
[/opt/Alire/bin/alr]
0x457d88 Semantic_Versioning.Parse.Eat_Number at semantic_versioning.adb:78
0x45981b Semantic_Versioning.Parse.Accept_Number at semantic_versioning.adb:142
0x459b07 Semantic_Versioning.Parse.Accept_Number at semantic_versioning.adb:159
0x459b07 Semantic_Versioning.Parse.Accept_Number at semantic_versioning.adb:159
0x45af3e Semantic_Versioning.Parse at semantic_versioning.adb:179
0x9c0403 Alire.Origins.Deployers.System.Apt.Detect at alire-origins-deployers-system-apt.adb:73
0x89b0b9 Alire.Externals.From_System.Detect at alire-externals-from_system.adb:46
0x8b1a18 Alire.Externals.Lists.Detect at alire-externals-lists.adb:34
0x926d0d Alire.Index.Detect_Externals at alire-index.adb:189
0x4d0ed2 Alr.Commands.Search.Execute at alr-commands-search.adb:270
0x4cb8b8 Alr.Commands.Search.Execute at alr-commands-search.adb:302
0x4cbce7 Alr.Commands.Search.Execute at alr-commands-search.adb:23
0x53939b Alr.Commands.Sub_Cmd.Execute at clic-subcommand-instance.adb:749
0x54587e Alr.Commands.Execute at alr-commands.adb:561
0x436183 Alr.Main at alr-main.adb:13
0x438de1 Main at b__alr-main.adb:2257
[/lib/x86_64-linux-gnu/libc.so.6]
0x79e47b02a1c8
0x79e47b02a289
[/opt/Alire/bin/alr]
0x43601c _start at ???
0xfffffffffffffffe

error: Empty point number
error: alr encountered an unexpected error, re-run with -d for details.
error: error location: 0x457d88 Semantic_Versioning.Parse.Eat_Number at semantic_versioning.adb:78

This looks like some deep knowledge of Alire’s internals is required to understand what is actually wrong with my setup. :slightly_smiling_face:

Ok, with regards to the Build & Run issue it looks like this is down to permissions. I believe the .mount_gnatstHaLzyv directory has been mounted as read-only by something so that no writing is permitted. As this is under /tmp I tried deleting that (hopefully that should be ok?) but I’m not able to do that not even as sudo (getting a Read-only file system error).

Does that need to be unmounted first and then deleted?

Any input from the makers of Alire? (or maybe GNAT Studio?) :slightly_smiling_face:

Just to point-out again that running an alr build and alr run on the command line works fine.

I’m unfortunately just an alire newbie, but a lot of alire users do frequent these forums, including the developers, so perhaps they’ll see this thread and have some input on the other issues.

A lot of alire chat happens on gitter as well, so if you need faster responses, it might be another option: https://app.gitter.im/#/room/#ada-lang_Alire:gitter.im

I believe I hit the same issue with the latest appimage. If you extract it and doinstall as shown as optional on the release page (I guess it isn’t optional right now) then it should resolve the issue. You should find the previous version works but the latest has a newer language server so I would extract and install.

I expect it is writing (looks like etc/alire) to the installation location as I notice mine is owned by my user when it should normally be root. It shouldn’t be doing that (I assume a bug).

Running (as sudo) the doinstall nearly worked.

For a fresh Alire project building and building & running works fine. For a migrated project building is still complaining with the
Could not expand argument in command line: %fp error but building & running works just fine for some reason (you’d have thought the first stage is the same as the standalone build but maybe that’s not the case).

I’m also still having some issues with some Alire commands which I might bring-up on the gitter if these can’t be resolved here. i.e. running
alr search --full --external-detect gnat_ complains with

error: Empty point number                                                                   
error: alr encountered an unexpected error, re-run with -d for details.
error: error location: 0x457d88 Semantic_Versioning.Parse.Eat_Number at semantic_versioning.adb:78

which I guess makes installing new things like compilers etc a bit hard.

Thanks very much @JeremyGrosser and @kevlar700 for all the help!

I’ve seen this error in some of my GNAT Studio installations when trying to debug otherwise properly-working projects. I’m afraid I don’t know the solution.

This is solved in the development branch. I’d like to have a patch release of Alire soon that will include it.

Running alr toolchain --select is the simplest way to install toolchain components and should not be affected by the bug.

No worries, thank you. (looks like it’s down to some kind of permissions misconfiguration)

This is solved in the development branch. I’d like to have a patch release of Alire soon that will include it.

That’s great, thank you.

Running alr toolchain --select is the simplest way to install toolchain components and should not be affected by the bug.

I see, I was under the impression that a toolchain needs to be installed first (running alr toolchain --install) and then selected for the project with toolchain --select.

By the way, when I run alr toolchain --install (as mentioned here) I am getting:

error: Unrecognized option '--install' (command/topic "toolchain").
error: try "alr help toolchain" for more information.

Yes, --install was deprecated as it was equivalent to doing an alr get. It was not installing it for use by Alire, but outside of its control, so it could be confusing.

Now there’s only --select, that will both download and select the default compiler to be used by Alire.

Gotcha, thanks for clarifying.