Is there a way to manually install a toolchain for Alire

Anyone familiar enough with Alire to help provide some steps to manually install a toolchain for Alire by hand. I was looking to get it running on my work computer. I finally got it approved through our IT process, but Alire fails to install any toolchains. I initially thought it was a permissions issue, so I installed Alire to a local folder and changed the settings so that the cache folder was made locally to that folder as well (instead of in AppData).

It still failed to install the toolchain, so it probably uses a temp directory somewhere I cannot control. So my next thought was to just manually install GCC. I took a look at the alire index to see where it got the toolchains from, but when I inspected the ZIP files linked there, they didn’t contain everything that my home computer’s alire toolchains had, so I think Alire generates some extra stuff when installing the toolchain.

Any direction on where to get the additional files needed to hand install the toolchains? Or any instructions that could help?

To install the toolchain

  • Fetch corresponding archive from GitHub release. Take, for instance, gnat-x86_64-windows64-14.2.0-1.tar.gz and gprbuild-x86_64-windows64-22.0.0-1.tar.gz
  • unzip it some where and add bin folders to the PATH. On Linux/Mac OS X Alire 2.0.2 unpack it to ~/.local/share/alire/toolchains. I don’t remember the Windows case.
  • If you have bin folders of the gnat you can configure alire with alr toolchain --select and choose “external” toolchain.
1 Like

Thanks! Any tips on how to install it in the alire ecosystem cache folders manually? It looks like there is a toml file that I need to generate.

it makes some files in .config.

max@c9995e76199a:~$ diff -Naur .config_ .config
diff -Naur .config_/alire/indexes/providers.toml .config/alire/indexes/providers.toml
--- .config_/alire/indexes/providers.toml	1970-01-01 00:00:00.000000000 +0000
+++ .config/alire/indexes/providers.toml	2024-11-10 18:00:30.150204510 +0000
@@ -0,0 +1,21 @@
+a0b_time_platform = [
+"a0b_armv7m_systick_clock",
+"a0b_armv7m_systick_clock_timer",
+]
+a0b_timer_platform = [
+"a0b_armv7m_systick_clock_timer",
+"a0b_atsam3x8e_tc5_timer",
+"a0b_stm32f401_tim11_timer",
+]
+florist = [
+"florist_blady",
+]
+gnat = [
+"gnat_arm_elf",
+"gnat_avr_elf",
+"gnat_external",
+"gnat_native",
+"gnat_riscv64_elf",
+"gnat_xtensa_esp32_elf",
+]
+
diff -Naur .config_/alire/settings.toml .config/alire/settings.toml
--- .config_/alire/settings.toml	2024-11-10 18:00:19.232271430 +0000
+++ .config/alire/settings.toml	2024-11-10 18:02:08.908353720 +0000
@@ -1,3 +1,11 @@
 [index]
 last_update = 233085587
+[toolchain]
+assistant = false
+[toolchain.external]
+gnat = false
+gprbuild = false
+[toolchain.use]
+gnat = "gnat_native=14.2.1"
+gprbuild = "gprbuild=22.0.1"
 
max@c9995e76199a:~$ ls .local/share/alire/
toolchains
max@c9995e76199a:~$ ls .local/share/alire/toolchains/
gnat_native_14.2.1_06bb3def  gprbuild_22.0.1_24dfc1b5  must_reload
max@c9995e76199a:~$ ls .local/share/alire/toolchains/g
gnat_native_14.2.1_06bb3def/ gprbuild_22.0.1_24dfc1b5/    
max@c9995e76199a:~$ ls .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/
alire  alire.toml  bin  etc  include  lib  lib64  libexec  share  x86_64-pc-linux-gnu
max@c9995e76199a:~$ ls .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire.toml 
.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire.toml
max@c9995e76199a:~$ ls .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire/
flags
max@c9995e76199a:~$ ls .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire/flags/
complete_copy
max@c9995e76199a:~$ cat .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire/flags/complete_copy 
max@c9995e76199a:~$ less .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire.toml 
m

An empty file .local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/alire/flags/complete_copy and a reformated alire.toml.

1 Like

Set an environment variable ALIRE_SETTINGS=/path/you/can/write and Alire will store both config and cache in there.

BTW Max advice about how to use a custom toolchain is right, you put it in your path and then configure Alire with the gnat_external compiler.

Although with the relocation I mentioned you should be able to use Alire’s indexed compilers.

1 Like

My main problem was I couldn’t install indexed compilers (assuming this means the ones in the cache/toolchains folder?) via Alire (it fails with an exception thrown, but only on my work computer, so probably a security setting, verified it wasn’t a permissions issue at least as it failed in a folder I had complete permissions on), so I was trying to manually create the indexed myself but manaully downloading, unzipping, and then putting in the ancillary files myself but I didn’t know how to do that myself. I was kinda hoping I could find the templates for the extra files generated for those installations so I could do them myself (since I cannot get alire to complete the process).

For example, on the successful install of GCC 14 on my home computer, alire takes the zipped files from github, unpacks the, then adds an alire.toml and an alire folder (which are not present in the zipped versions of the compiler files). I was looking for more info on how to get those files and the rules behind them so I can manually create them on my work computer in addition to any other changes I need to make for alire to “think” it installed those. I think Max’s last post has some of that in it (thanks!)

I’ll definitely look into what you and Max mentioned about external compiler setup. Thanks for the tips!

The error might be related to a temporary location rather than the final destination, so you could take a look at the logic on temporary folders in Alire.Platforms.Folders. If you can provide the error message I can try to help.

About the details of these files/folders: if you can do an install on another computer, I presume you can simply copy the manifest and alire folder. Recreating them by hand is probably going to be too fragile.

I would still try first to just download the compiler manually or with alr get, put it in path, and configure Alire to use the external compiler.

Yep, my initial plan was to copy those over. It’s a bit difficult because of the IT situation here, but it’s definitely my fall back option. My hope was I could find the templates alire used for those so I could set myself up a small program to generate them on this side and save me from the transfer process here at work.

I asked back on gitter back in August about it, but I traced the exception to the function Deploy_Steps. It raises an exception with the message: “ERROR: Deployment of <stuff>”

The is just my abbreviation of all the folder paths and stuff, cause copy/paste between work and home computer is tough. It was a case statement based on OS and referenced a tar.gz file deployment to my local directory (I moved the cache folder to my local director incase there were permission issues with AppData and subfolders).

Full message:

preformatted text copy if that is easier to deal with:

Note: Deploying gprbuild=22.0.1...
################################################################################################################# 100.0%
ERROR: Deployment of (case OS is Linux => (case Host_Arch is X86_64 => binary archive gprbuild-x86_64-linux-22.0.0-1.tar.gz at https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-22.0.0-1/gprbuild-x86_64-linux-22.0.0-1.tar.gz), Macos => (case Host_Arch is X86_64 => binary archive gprbuild-x86_64-darwin-22.0.0-1.tar.gz at https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-22.0.0-1/gprbuild-x86_64-darwin-22.0.0-1.tar.gz), Windows => (case Host_Arch is X86_64 => binary archive gprbuild-x86_64-windows64-22.0.0-1.tar.gz at https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-22.0.0-1/gprbuild-x86_64-windows64-22.0.0-1.tar.gz)) with hash sha256:c842bbc58b28ad0f1c1f7ba147d59e2c9fc4b8f74355ac734831bc779159b47e to D:\Program_Files\alire\cache\toolchains\gprbuild_22.0.1_c842bbc5 failed

Note that I got the same failure when my cache was in AppData (just a different path in the error).

My Initial guess is that we have some sort of security rule that impedes some methods of unzipping. I can manually unzip files, but even Cargo from rust failed due to being unable to unpack their zip files.

OK, then I guess the failure is to be expected.

About templates, there’s no such thing at present in Alire, the alire.toml file is regenerated from the data read from the index. Typically, it will contain the same information present in you local index manifest, except for the origin, which is either omitted or resolved to the current platform (for binary crates).

Yep unfortunately, I always have to crawl with the tools they give me at work. Ok thanks! I’ll see if I can make my own templates for it then and maybe an external program to manage it. Thanks!!