alire-project / alire

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

Alire fails to install external re2c when it is a dependency #1312

Closed stephe-ada-guru closed 1 year ago

stephe-ada-guru commented 1 year ago

An Emacs ada-mode user reports this problem:

OK, I can reproduce my problem:

Environment: Debian bullseye, Emacs 27.1, re2c not installed but available via apt:

❯ apt search ^re2c Sorting... Done Full Text Search... Done re2c/stable 2.0.3-1 amd64 lexer generator for C, C++ and Go

If I start ./build I get the following output:

❯ ./build.sh alr is /home/re/.local/bin/alr building ada-mode executables via Alire warn: warn:    New solution is incomplete. warn:    +  emacs_wisi          4.2.0  (new) warn:    +♼ gnat                12.2.1 (new,installed,gnat_native) warn:    +  gnatcoll            22.0.0 (new,indirect) warn:    +  libgpr              22.0.0 (new,indirect) warn:    +↪ re2c                >=2.2 (new,external) warn:    +  stephes_ada_library 3.7.2  (new) warn:    +  wisitoken           4.1.0  (new) warn:    +  xmlada              22.0.0 (new,indirect) warn: warn: Could not find a complete solution for emacs_ada_mode=8.0.3 *Build will*fail unless externals are made available, do you want to continue? [Y] Yes  [N] No  (default is No)

(red bold marking by me)

After starting the build process by hitting y it starts to include a few crates until it shows the warning messages

warn: The following external dependencies are unavailable within Alire: warn:    re2c>=2.2 warn: They should be made available in the environment by the user. warn: Generating possibly incomplete configuration because of missing dependencies

And it finally fails as announced since it cannot find re2c

ⓘ Running pre_build actions for emacs_ada_mode=8.0.3... /home/re/.emacs.d/elpa/ada-mode-8.0.4/emacs_ada_mode_8.0.3_ab552d7b/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/bin/wisitoken-bnf-generate.exe --output_bnf ada_annex_p.wy if [ -f ada_annexpparse_table.txt ]; then mkdir -p bin; for file in ada_annexpparse_table.txt; do mv $file bin; done fi re2c --no-generation-date --debug-output --input custom -W -Werror --utf-8 -o ada_annex_p_re2c.c ada_annex_p.re2c make: re2c: No such file or directory make: *** [/home/re/.emacs.d/elpa/ada-mode-8.0.4/emacs_ada_mode_8.0.3_ab552d7b/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire_rules.make:28: ada_annex_p_re2c.c] Error 127 rm ada_annex_p.re2c warn: A pre-build action failed, re-run with -vv -d for details

If I install re2c manually via apt / apt-get I can build a working ada-mode

Perhaps it is a problem of Alire on my computer. If I search for it it is not found, but I can install it!

❯ alr index --update-all Already up to date.

❯ alr search re2c No hits

❯ alr show re2c Not found: re2c* There are external definitions for the crate. Use --external to show them. ❯ alr show --external re2c Kind           Description                Details Available System package 1 candidate system package Debian: re2c True                                           Ubuntu: re2c Msys2: re2c Arch: re2c Rhel: re2c Centos: re2c Fedora: re2c others: unavailable

❯ alr get re2c The system package 're2c' is about to be installed. This action might require admin privileges and impact your system installation. Do you want Alire to install this system package? [Y] Yes  [N] No  [A] Always  (default is Yes) Using default: Yes Selecting previously unselected package re2c. (Reading database ... 314174 files and directories currently installed.) Preparing to unpack .../re2c_2.0.3-1_amd64.deb ... Unpacking re2c (2.0.3-1) ... Setting up re2c (2.0.3-1) ... Processing triggers for man-db (2.9.4-2) ...

I don't understand why alr can install re2c if run manually but cannot install it as part of emacs-ada-mode.

Rolf

mgrojo commented 1 year ago

I think this might be due to the version requirements specified to Alire.

Version required is >=2.2:

 warn:   >=2.2 (new,external)

Version available to apt is 2.0.3:

 Unpacking re2c (2.0.3-1) ...

If rec2c version 2.0.3 is working, I suppose you have to lower the version requirement, otherwise Alire will not resolve the external package as part of a workable solution, as specified.

RREE commented 1 year ago

OK, I checked it. If I set the dependency to re2c = "~2.0.3" in alire.toml the build process works fine. I cannot tell if the file generated via re2c v2.0.3 works better or worse than the one generated by v2.2 or v3.0

stephe-ada-guru commented 1 year ago

The first error message could be better; it's not at all clear which of the requirements is not met.

State explicitly which crates were not found, and why; list the found re2c version.

I'll have to test with re2c 2.0.3.

mosteo commented 1 year ago

There's already some changes in master to better point the reason of missing dependencies:

https://github.com/alire-project/alire/pull/1127

And a feature to emit a recap of all that's missing at the end is also being tracked:

https://github.com/alire-project/alire/issues/685

So I'm closing this one, as alr was working as expected in this case.