alire
alire copied to clipboard
Self-build generates wrong OS
Found on macOS, don’t know whether it happens with others.
With your released alr 1.2.0 for macOS, alr version reports os: MACOS.
Building 877ef22 (1.3.0-dev) with alr 1.2.0, alr version reports os: LINUX.
Building it with gprbuild, alr version reports os: MACOS.
(by the way, why is alr version’s report double-spaced?)
Is environment variable OS=macOS?
This is a rebuild using release 1.2.0 (I get the same effect using 1.3.0-dev).
lockheed:alire simon$ 1.2.0/bin/alr clean
lockheed:alire simon$ OS=macOS 1.2.0/bin/alr build -- -gnatwn
...
Link
[link] alr-main.adb
Build finished successfully in 229.55 seconds.
lockheed:alire simon$ bin/alr version
APPLICATION
alr version: 1.3-dev
libalire version: 1.3-dev
compilation date: 2022-06-09 17:01:17
compiler version: 12.1.0
...
SYSTEM
distribution: DISTRO_UNKNOWN
host-arch: X86_64
os: LINUX
target: NATIVE
toolchain: USER
word-size: BITS_64
If I say OS=macos instead, I get
lockheed:alire simon$ OS=macos 1.2.0/bin/alr build -- gnatwn
error: Trying to set an already defined environment variable:
error: OS is already defined as 'macos' but new value is 'macOS'
which is quite confusing, but at least shows that alr 1.2.0 knows what OS to build for.
Quite puzzling. And the export of OS=macOS is already in the alire.toml of alr, so it should not be needed explicitly (this is likely the cause of the conflict with OS=macos).
Unfortunately I'm a bit short on time with Ada-Europe preparations, so I'm not sure when I'll get to it, but thanks for the report and for your patience.
OS is used by alr_env.gpr only. The project file in the manifest is alr.gpr. With gpr-set-externals changed to macos = { ALIRE_OS = "osx" } in the manifest, it works (on macOS). This issue should also be a problem on Windows.
Thanks for the digging, Jesper.