First of all, I’m currently learning Ada and doing lots of exploration to better understand Ada semantics and GNAT implementation details (features supported, how they’re actually implemented, optimizations applied at the assembly level, etc). So I tend to compare different versions of GNAT. For instance, recently I found an optimization regression in GCC 14+ (which turned out to be a known regression) when looking at the assembly code produced by GNAT (14+) of something like this:
type R is record
A, B, C, D : Integer
end record;
function Init (X : Integer) return R is
(R'(X+1, X+2, X+3, X+4));
Some people might say none of this is necessary to use Ada effectively, and it’s probably true to a certain degree, but I’m a systems programmer (coming from C) and that’s what I intent to use Ada for, so I can’t help it, my minds needs to understand all this
.
Second, there is a problem with Alire. alr toolchain --select only looks for binary gnat in PATH to detect the “external” toolchain. Although Debian ships different versions of GNAT (including 15/16), GNAT 14 is the default, and installed binary gnat points to GNAT 14. GNAT 15/16 packages install binaries gnat-15/gnat-16, but I couldn’t find a way to tell Alire to look for gnat-* binaries. So, by default, Alire will only be able to detect system/“external” GNAT 14. If I want to use system GNAT 15/16 with Alire I need to apply some dirty workaround: manually create a gnat symlink or something pointing to GNAT 15/16, put it somewhere in PATH, then run alr tooschain --select. I rather don’t use Alire at all (it’s great it exists but I rather use packages provided by the system package manager when possible), but I still need it to use other Ada-related packages not shipped by Debian (gnatprove, gnatdoc, gnatformat, etc). I wish Alire was able to detect multiple system/external toolchains.
An alternative is to drop the system packages entirely and just download everything with Alire. I’m not too happy with this because it downloads redundant binaries (e.g. GCC, which I already have installed in my system) and, honestly, I trust more the packages shipped by Debian, in that they will be better supported/integrated into the whole system. But also, the toolchains downloaded by Alire can only be used through alr, within an Alire project. Again, I have to apply dirty workarounds to my environment if I want to use standalone gprbuild/gnatmake/gnat/gnatprove/etc from Alire.
So, for general Ada exploration, it’s easier for me to just install system GNAT (14) and use Alire with it.
Debian testing ships packages gnat-11/12/13/14/15/16 (same as gcc-11/12/13/14/15/16), but the default gnat package depends on gnat-14. So GNAT 14 is the default, official GNAT package in Debian stable (production release) and testing (next-to-be-production release). Any Ada package meant to be shipped by Debian has to be compiled by the default GNAT (i.e GNAT 14). GNAT 14 is even the default GNAT version in Debian unstable (the experimental branch), although it’s using GNAT 14.4 there (vs 14.3 in testing). This means GNAT 14 is still supported, at least by Debian, and probably will continue to be supported for a long time (as I understand, Debian follows upstream GCC/GNAT releases/support). So I would say this is relevant, and needs to be fixed.
Although you’re probably right in that the default GNAT version should be bumped to (at least) GNAT 15. GCC 15 is already the default GCC there after all.
So, how does GNAT dev/support work between GCC team and AdaCore? If I were to file a bug against upstream GCC/GNAT (https://gcc.gnu.org/bugs/#gnat), would it be picked by AdaCore or how does it work?
Thanks! As explained above, I don’t have a problem with upgrading GNAT. But would appreciate any info on how to tell Alire, if possible at all, to:
- Look for “external” binaries other than
gnat.
- Support multiple external toolchains.
- When downloading a toolchain, use system GCC (and other dependencies) rather than downloading them too.