alire-project / alire

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

If `alr`'s host architecture changes, `gnat_native` toolchain breaks #1796

Open rongcuid opened 1 week ago

rongcuid commented 1 week ago

Checklist

Describe the bug Toolchain consistency breaks if alr's architecture changes.

To Reproduce Steps to reproduce the behavior:

  1. On a Mac Apple Silicon machine
  2. Install alr x86-64 version
  3. alr toolchain --select and pick gnat_native
  4. X86-64 toolchain gets installed
  5. Install alr arm64 version
  6. No project will build now because kb: warning: can't find a toolchain for the following configuration: language 'Ada', target 'aarch64-darwin', default runtime
  7. alr toolchain --select will not install the correct toolchain

Expected Behavior At step 7, alr should detect that gnat_native does not point to the correct host arch and thus should reinstall the correct toolchain

alr version Paste here the output of alr version.

APPLICATION
alr version:               2.0.2+9b80158
libalire version:          2.0.2+9b80158
compilation date:          2024-10-09 16:57:49
compiled with version:     14.2.0

CONFIGURATION
settings folder:           /Users/rongcuid/.config/alire
cache folder:              /Users/rongcuid/.local/share/alire
vault folder:              /Users/rongcuid/.local/share/alire/releases
build folder:              /Users/rongcuid/.local/share/alire/builds
temp folder:               /private/var/folders/tw/8vsfcypj5rx4gbst7z5nrj7c0000gn/T
force flag:                FALSE
non-interactive flag:      FALSE
community index branch:    stable-1.3.0
compatible index versions: ^1.1 & <=1.3.0
indexes folder:            /Users/rongcuid/.config/alire/indexes
indexes metadata:          OK
index #1:                  (community) git+https://github.com/alire-project/alire-index#stable-1.3.0
toolchain folder:          /Users/rongcuid/.local/share/alire/toolchains
toolchain assistant:       disabled
tool #1 gnat:              gnat_native=14.2.1
tool #2 gprbuild:          gprbuild=24.0.1
system package manager:    /opt/local/bin/port
distro detection disabled: FALSE

WORKSPACE
root status:               VALID
root release:              ada_ray=0.1.0-dev
root load error:           none
root folder:               /Users/rongcuid/tmp/ada_ray
current folder:            /Users/rongcuid/tmp/ada_ray

SYSTEM
distribution:              MACPORTS
host-arch:                 AARCH64
os:                        MACOS
target:                    NATIVE
toolchain:                 USER
word-size:                 BITS_64

alr logs If pertinent, paste the output of alr -vv -d <your command> here.

mosteo commented 1 week ago

Thanks for the report. Actually, I believe the problem will be the mismatch between gprbuild and the installed gnat, rather than gnat itself.