Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portable Alire with Toolchains on USB flash Drive #1587

Closed
sanyaade-teachings opened this issue Feb 25, 2024 · 6 comments
Closed

Portable Alire with Toolchains on USB flash Drive #1587

sanyaade-teachings opened this issue Feb 25, 2024 · 6 comments

Comments

@sanyaade-teachings
Copy link

Hi Everyone,

Good day to you all, many thanks for your efforts.

Issues with Alire Windows edition
I have been trying to get a standalone Alire on a USB flash drive for my students' usage.

The current problem is that Alire is defaulted to e.g. 'C:\Users\Lookma.cache\alire\msys64'
We will want to override this and specify another folder.

We are trying to put everything on a USB flash memory to make it portable since our students move around with their CapStone projects. They could create a window batch file to update the system path if the USB flash drive letter changes and add the new path (just like in Linux: we could export the path using a .sh file).

Any tips, or direction for this will be highly appreciated!

God blesses!!!

Regards

@mosteo
Copy link
Member

mosteo commented Feb 26, 2024

You can change that folder with:

alr config --global --set msys2.install_dir <path/to/install>

Hope this is what you need.

@mosteo mosteo closed this as completed Feb 26, 2024
@sanyaade-teachings
Copy link
Author

You can change that folder with:

alr config --global --set msys2.install_dir <path/to/install>

Hope this is what you need.

Many thanks!
Does this apply to other toolchains, packages and configurations? Can we override the default settings using this --global --set directives?

Testing this out tonight!

God blesses!!!

Regards

@mosteo
Copy link
Member

mosteo commented Feb 27, 2024

Yes, there are other possible overrides:

The environment variable ALR_CONFIG=</path/to/config> allows to change where you store your configuration, but that will also cause all toolchains to be stored inside that configuration path.

In the upcoming 2.0 release, the build cache and toolchains will be relocatable separately, see #1593.

If you want everything in the portable USB, setting ALR_CONFIG and then configuring msys2.install_dir should ensure everything is indeed there.

@sanyaade-teachings
Copy link
Author

sanyaade-teachings commented Feb 29, 2024

@mosteo :
Many thanks!

1.) What works:
alr config --global --set msys2.install_dir E:/msys2 (this works as expected)

2.) What did not work (not working):
But ALR_CONFIG=</path/to/config> does not work or is recognised.
I tried a few other tricks but without success either:

Perform the following commands:
alr ALR_CONFIG=E:/Alire/bin
image

Error messages:
image

Also tried, alr config –global --set ALR_CONFIG=E:/Alire/bin/ (this return error message below)
image

Next I tried the command alr config --global ALR_CONFIG=E:/Alire/bin
image

No error messages but the giving path was not set. No effect

Maybe I am not using the ALR_CONFIG=</path/to/config> the right way. (Alire version is 1.2.2)

God blesses!!!

Regards

@mosteo
Copy link
Member

mosteo commented Feb 29, 2024

ALR_CONFIG is an environment variable. In power shell, you'd set (it'll work only until you close the terminal, there are ways to make it persistent) it like this:

$env:ALR_CONFIG=<path>

Once set, you can verify alr is aware by checking the output of alr version (also in PS with echo $env:ALR_CONFIG)

@sanyaade-teachings
Copy link
Author

sanyaade-teachings commented Mar 1, 2024

ALR_CONFIG is an environment variable. In power shell, you'd set (it'll work only until you close the terminal, there are ways to make it persistent) it like this:

$env:ALR_CONFIG=<path>

Once set, you can verify alr is aware by checking the output of alr version (also in PS with echo $env:ALR_CONFIG)

Oh! Now I understand. I do have an old batch file created a few years ago that I was using for compiling Pi-Pico RP2040 board.
I think I need to just update the Alire version to the current 2.0. I will retrofit it for the USB flash memory.
Below is my batch-file configuration on my old Laptop:

@echo Off
set gnat2024dir=%CD%
set aliredir=%CD%/alire/bin
set gnatstudio2024=%CD%/bin
set arm-elf=%CD%/2020-arm-elf
set PATH=%PATH%;%gnat2021dir%;%gnatcompiler2021%;%aliredir%;

So I need to ALR_CONFIG= ( I did just now)
set ALR_CONFIG=%CD%/Alire/bin
set PATH=%PATH%;%ALR_CONFIG%;

==> Now I get a new error about Ownership: Below saying that
fatal: detected dubious ownership in repository at 'E:/Alire/bin/indexes/community/repo'
'E:/Alire/bin/indexes/community/repo' is on a file system that does not record ownership
To add an exception for this directory, call:
git config --global --add safe.directory E:/Alire/bin/indexes/community/repo
Not resetting hidden file - E:\Alire\bin\indexes\community\repo.git
Not resetting hidden file - E:\Alire\bin\indexes\community\repo.git
ERROR: Could not add community index: Command ["git", "checkout", "-q", "stable-1.2.1"] exited with code 12
image

Git complaining about ownership due to E:\ being a USB device?

God blesses!!!

Regards

UPDATE:
Running:
git config --global --add safe.directory E:/Alire/bin/indexes/community/repo

Removes the above error messages.
I was able to install:
alr get gnat_native
alr get gprbuild

image

I will continue to explore this USB option until I get it done, as I will need it often in my teachings and for students' perusals
Students can download the USB zip image, extract it, run Alire/tools from the USB or transfer it onto their Laptop and work it from anywhere. We have similar tools in our toolsets for C/C++, LAMP, Python and Java. Why not Ada?

Cheers!

God blesses!!!

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants