Problem building crate with libadalang

I tried to play a bit with libadalang, so I created a binary crate followed by:

with libadalang
alr build

but I got the following build errors:

gpr.adb:1757:13: error: ambiguous expression (cannot resolve "To_Lower")
gpr.adb:1757:13: error: possible interpretation at a-chahan.ads:273
gpr.adb:1757:13: error: possible interpretation at s-casuti.ads:99
gpr.adb:1757:32: error: ambiguous expression (cannot resolve "To_Lower")
gpr.adb:1757:32: error: possible interpretation at a-chahan.ads:273
gpr.adb:1757:32: error: possible interpretation at s-casuti.ads:99

   compilation of gpr-conf.adb failed

The compilation error looks identical to the one in this 4-year-old post: https://www.reddit.com/r/ada/comments/ohflj5/problem_with_gnatcoll_gmp_and_alire/, but I could not find a solution or a proper bug report.

Any ideas? My alire version is 2.0.1.

Now tried it with alire 2.1.0. Building and running using alr build and alr run now works, but compiling from GNAT Studio gives an error: gpr.gpr 30:4 value “unix” is illegal for typed string “Target”

Hello, what version of libadalang are you building?

Can you give us the output of alr show --solve.

The dependencies as shown in the output of alr show -- solve are:

Dependencies (direct):
libadalang^25.0.0
Dependencies (solution):
adasat=25.0.0
gnat=14.2.1 (gnat_native)
gnatcoll=25.0.0
gnatcoll_gmp=25.0.0
gnatcoll_iconv=25.0.0
langkit_support=25.0.0
libadalang=25.0.0
libgmp=6.2.1
libgpr=25.0.0
libgpr2=25.0.0
prettier_ada=25.0.0
vss=25.0.0
xmlada=25.0.0
Dependencies (graph):
draht_gen=0.1.0-dev → libadalang=25.0.0 (^25.0.0)
gnatcoll=25.0.0 → gnat=14.2.1 (gnat_native) (>=13)
gnatcoll=25.0.0 → libgpr=25.0.0 (~25.0.0)
gnatcoll_gmp=25.0.0 → gnatcoll=25.0.0 (~25.0.0)
gnatcoll_gmp=25.0.0 → libgmp=6.2.1 (*)
gnatcoll_iconv=25.0.0 → gnatcoll=25.0.0 (~25.0.0)
langkit_support=25.0.0 → adasat=25.0.0 (^25)
langkit_support=25.0.0 → gnatcoll=25.0.0 (^25)
langkit_support=25.0.0 → gnatcoll_gmp=25.0.0 (^25)
langkit_support=25.0.0 → gnatcoll_iconv=25.0.0 (^25)
langkit_support=25.0.0 → prettier_ada=25.0.0 (^25)
libadalang=25.0.0 → gnatcoll=25.0.0 (^25)
libadalang=25.0.0 → gnatcoll_gmp=25.0.0 (^25)
libadalang=25.0.0 → gnatcoll_iconv=25.0.0 (^25)
libadalang=25.0.0 → langkit_support=25.0.0 (^25)
libadalang=25.0.0 → libgpr2=25.0.0 (^25)
libgpr=25.0.0 → gnat=14.2.1 (gnat_native) (/=2020)
libgpr=25.0.0 → xmlada=25.0.0 (~25.0.0)
libgpr2=25.0.0 → gnat=14.2.1 (gnat_native) (>=14)
libgpr2=25.0.0 → gnatcoll=25.0.0 (~25.0.0)
libgpr2=25.0.0 → gnatcoll_gmp=25.0.0 (~25.0.0)
libgpr2=25.0.0 → gnatcoll_iconv=25.0.0 (~25.0.0)
prettier_ada=25.0.0 → gnatcoll=25.0.0 (^25)
prettier_ada=25.0.0 → vss=25.0.0 (^25)
vss=25.0.0 → gnat=14.2.1 (gnat_native) (>=11 & <2000)
xmlada=25.0.0 → gnat=14.2.1 (gnat_native) (>=11)

I now could get around the error by hacking the gpr.gpr file.

Do you an “OS” environment variable set? Because it seems like it.

No, that variable does not exist. I have no idea where that “unix” value comes from.

Are you using GNAT Studio?

Yes. The problem only occurred when compiling from GNAT Studio. alr build worked after switching to Alire 2.1.0.

1 Like

In GNAT Studio there’s a panel to set scenario variables. It’s possible that the variable was set in this panel and that’s what was causing the issue.

Indeed, there is a scenario variable OS with the value “unix”. So that seems to be the cause.

I’m also getting a warning in GNAT Studio: “Could not display all variables in the scenario view: a scenario variable named ‘EXTERNALLY_BUILT’ appears more than once in the project tree.”