alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
289 stars 51 forks source link

Building ada_language_server cannot be solved #1732

Closed HiPhish closed 3 months ago

HiPhish commented 3 months ago

Describe the bug When I try to download and build the ada_language_server Alire gets stuck endlessly trying to solve things. (I am new to Ada, so please forgive me if I don't know how to properly name things)

To Reproduce Steps to reproduce the behavior:

  1. Run alr get --build ada_language_server
  2. After a couple of seconds Alire tells me that no complete solution could be found
  3. This keeps happening

I have the following things installed on Void Linux:

Expected Behavior It should build normally. The same command with the hello package works fine, so GNAT and Alire are working at least for the trivial base case.

alr version alr 2.0.1

alr logs

$ alr get --build ada_language_server
warn: Spent 0.15 seconds exploring complete solutions
warn: Exploring incomplete solutions to dependencies, this may take some time...
warn: Complete solution not found after 6 seconds.
ⓘ The best incomplete solution yet is:

   RELEASE                 DEPENDENCY
   gnat_external=13.2.0    gnat((>=12 & <=2000) & (/=2020)) & (>=11) (solved)
   gnatcoll=23.0.0         gnatcoll((23.0.0) & (^23)) & (~23.0.0) (solved)
   gnatcoll_gmp=23.0.0     gnatcoll_gmp^23 (solved)
   gnatcoll_iconv=23.0.0   gnatcoll_iconv^23 (solved)
   langkit_support=23.0.0  langkit_support^23 (solved)
   libadalang=23.0.0       libadalang(23.0.0) & (^23.0.0) (solved)
   libadalang_tools=23.0.0 libadalang_tools23.0.0 (solved)
   (none)                  libgmp* (hinted)
   libgnatdoc=23.0.0       libgnatdoc23.0.0 (solved)
   libgpr=23.0.0           libgpr~23.0.0 (solved)
   markdown=23.0.0         markdown23.0.0 (solved)
   templates_parser=23.0.0 templates_parser^23.0.0 (solved)
   vss=23.0.0              vss(23.0.0) & (>=23.0.0) (solved)
   xmlada=23.0.0           xmlada~23.0.0 (solved)

Do you want to keep solving for a few more seconds?
[Y] Yes  [N] No  [A] Always  (default is Yes) n
warn:
warn:    New solution is incomplete.
warn:    +📦      gnat             13.2.0 (new,gnat_external,indirect,executable in path)
warn:    +        gnatcoll         23.0.0 (new)
warn:    +        gnatcoll_gmp     23.0.0 (new,indirect)
warn:    +        gnatcoll_iconv   23.0.0 (new,indirect)
warn:    +        langkit_support  23.0.0 (new,indirect)
warn:    +        libadalang       23.0.0 (new)
warn:    +        libadalang_tools 23.0.0 (new)
warn:    +        libgnatdoc       23.0.0 (new)
warn:    +        libgpr           23.0.0 (new,indirect)
warn:    +        markdown         23.0.0 (new,indirect)
warn:    +        templates_parser 23.0.0 (new,indirect)
warn:    +        vss              23.0.0 (new)
warn:    +        xmlada           23.0.0 (new,indirect)
warn:    Missing:
warn:    +❗      libgmp           *      (new,indirect,missing)
warn:
warn: Could not find a complete solution for ada_language_server=23.0.0
Build will fail unless externals are made available, do you want to continue?
[Y] Yes  [N] No  (default is No) n
error: Crate retrieval abandoned.

I did not do alr -vv -d <your command> because I could not figure out how to pass n to the interactive input. Please let me know if it is necessary.

mosteo commented 3 months ago

warn: Missing: warn: +❗ libgmp * (new,indirect,missing)

Here's your issue. That is normally fulfilled by a system package, but since Void Linux uses an unknown (for Alire) package manager, that can't be solved.

Theoretically, if you install libgmp manually and accept that solution (since everything else is solved), the build might be successful.

Side note: Alire should eventually realize that there's no complete solution, but since there's a combinatorial explosion at play, that could take lots of time.

HiPhish commented 3 months ago

Thank you for the information, I was able to build the package.

That is normally fulfilled by a system package, but since Void Linux uses an unknown (for Alire) package manager, that can't be solved.

So if I was using something more common like Debian or Ubuntu Alire would have been able to detect that I have libgmp installed, right? Would it be a lot of work to support Void's XBPS? I am very new to Ada, so I cannot commit to doing it, but I'm curious.

mosteo commented 3 months ago

Yes, that's it.

It's not overly complex. Basically you need to identify the XBPS commands that provide the version of an installed package and that install a package (preferably without downgrading/removing anything). The worst part is the boilerplate to retrieve that information from Ada while ensuring robustness.

You need to implement this interface: https://github.com/alire-project/alire/blob/master/src/alire/alire-origins-deployers-system.ads (the subprograms marked as abstract).

Alas, we don't have a reference implementation where you simply replace the commands to invoke, but you can look at other implementations (all children packages of Alire.Origins.Deployers.System) and follow the closest one with the appropriate changes. I'm unfamiliar with XBPS, so I cannot say immediately which other package manager would be closer.