alire-project / alire

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

Boot strapping Alire on Windows not working #1401

Open krischik opened 1 year ago

krischik commented 1 year ago

I wanted to test how difficult it is to recompile a simple tool I wrote. It's targeted at the retrocomputing community so medium difficulty should be OK. I tried do to this a new fresh windows virtual machine the following command:

alr get atari_atr_tools
cd atari_atr_tools_1.1.3_1e2cccbb
alr build --release

AFAIK this should download all required tools and create a release version of the tool in question. However the result was: Alire Test.txt

Which is sad as it means I need to distribute binaries after all.

mosteo commented 1 year ago

I think there's a possibility that running alr update (so the just installed compiler is added to the solution) before the build could fix it.

Still, this points to a problem in the chain of events, as the compiler should be installed before attempting the solving. If the previous workaround indeed works, this would be a problem on only during a first run.

If the workaround doesn't work, that would point to some bad combo of the versions of gnat/gprbuild being used.

krischik commented 1 year ago

I think there's a possibility that running alr update before the build could fix it.

I think I tried alr update and it didn't work.

Still, this points to a problem in the chain of events, as the compiler should be installed before attempting the solving.

I tried with the following command:

alr toolchain --install "gnat"
alr toolchain --install "gprbuild"
alr get "atari_atr_tools"
PUSHD "atari_atr_tools_1.1.3_1e2cccbb"
        alr build --release
POPD

And that indeed worked: Alire-Success.txt

Good enough work around for my use case.

mosteo commented 1 year ago

I guess it was --select instead of --install (which doesn't exist)? That should indeed have had the same effect as an alr update, in the end the thing is that the toolchain be available before the crate dependencies are solved.

krischik commented 1 year ago

Install is mentioned in the --help text:

>alr toolchain --help
SUMMARY
   Manage Alire-provided toolchains

USAGE
   alr toolchain [options] [-u|--uninstall] [-i|--install crate[version set]] | --select [--local] [releases] [--disable-assistant]

OPTIONS
   --disable-assistant  Disable autorun of selection assistant          
   -i (--install)       Install one or more toolchain component         
   --install-dir=ARG    Toolchain component(s) installation directory   
   --local              Store toolchain configuration in local workspace
   --select             Run the toolchain selection assistant           
   -u (--uninstall)     Uninstall one or more toolchain component       

GLOBAL OPTIONS
   -c (--config=ARG)       Override configuration folder location                              
   -f (--force)            Keep going after a recoverable troublesome situation                
   -h (--help)             Display general or command-specific help                            
   -n (--non-interactive)  Assume default answers for all user prompts                         
   --no-color              Disables colors in output                                           
   --no-tty                Disables control characters in output                               
   --prefer-oldest         Prefer oldest versions instead of newest when resolving dependencies
   --version               Displays version and exits                                          
   -q                      Limit output to errors                                              
   -v                      Be more verbose (use twice for extra detail)                        
   -d (--debug[])          Enable debug-specific log messages                                  

DESCRIPTION
   Download toolchain elements, like GNAT and gprbuild, in the shared cache of 
   the active configuration.

   Run it without arguments to get a list of downloaded tools.

   Use --select without arguments to run the assistant to select the default 
   toolchain for this configuration. Adding --local will instead make the 
   selection apply only to the workspace (overriding a possible configuration-
   wide selection). Giving one or more releases argument will skip the assistant
   and set the release as the default.

   Specify --install/--uninstall and one or more crates name with optional 
   version set to make available or remove a tool.

   Run `alr help toolchains` for further information about toolchain management 
   and use.

And it seems to do what ist say it says. I guess I could used alr toolchain --select as well but that would result in more questions. And I'm doing all of that to write an installation guide and that should have as little questions as possible and be as simple as possible.

I think the problem is that that the first command typed is not the developer use case (alr init) but the end user use case (alr get) and that that is not as well tested as most of us are developer.

mosteo commented 1 year ago

Yes, sorry, brainfart on my part. The effect should be similar. It's good you found a simple workaround for your case; we still will need to fix the issue.