I’ve recently started working on a project that requires my complier to be above GNAT 4.8.5 – When I go to: Help > About
You can see that the version I’m using is 4.8.5
Also, when I run the gnatls -v command, I can see this…
[parallels@localhost ~]$ gnatls -v
GNATLS 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 1997-2013, Free Software Foundation, Inc.
Source Search Path:
<Current_Directory>
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/adainclude/
Object Search Path:
<Current_Directory>
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/adalib/
Project Search Path:
<Current_Directory>
/usr/x86_64-redhat-linux/lib/gnat
/usr/share/gpr
/usr/lib/gnat
[parallels@localhost ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=c,c++,ada
Thread model: posix
gcc version 7.3.0 (GCC)
[parallels@localhost ~]$
Please could someone be able to tell me how to update my GNAT compiler? Also, I’m using the Centos 7 Operating System.
Thank you,
Lloyd
2
Answers
You don’t need to install a compiler, you already have 3 (at least):
/usr/bin
/usr/local/bin
/home/parallels/opt/GNAT/2019/bin
Your
PATH
determines which GCC you pick up when you say justgcc
, and which GNATLS you pick up when you say justgnatls
, .. etc.According to a previous post, your
PATH
is:so when you say just
gcc
the system looks at the first entry in thePATH
(which is colon-separated) and .. there it is! so it executes that.If you’d built your 7.3.0 GCC with Ada support, it would have found gnatls in the same place. I have a very strong suspicion that you didn’t, so when you say just
gnatls
the system looks in/usr/local/bin
– no luck – then in/usr/local/sbin
– no luck – then in/usr/bin
– whoopee! but that’s the 4.8.5 GCC that you don’t want.Looking again at your
PATH
, the last part is mangled – you’ve added/home/parallels/bin
and/home/parallels/opt/GNAT/2019/bin
(twice) without including the colon separators, resulting in a nonexistent path. (/home/parallels/bin
may well have been added by the system – I assume that/home/parallels
is your home directory).What you need to do is to make sure that you pick up the compiler that came with GNAT CE 2019 by putting its location first in your
PATH
. One way of doing this is by editing your shell startup files.I don’t know how CENTOS sets accounts up, and I don’t know what your shell is. Assuming it’s
bash
(typeps -p $$
, should come back withbash
or perhaps-bash
; anything else, I can’t help), you need to edit one of the shell startup files – I’m a little unclear about this, but I think it’ll be~/.bashrc
(~
is shorthand for your home directory); see here for the gory details. Find the last mention ofPATH
and immediately after that line insertOpen a new terminal window and say e.g.
gnatls -v
– you should pick up the GNAT CE 2019 one.Only way I know of updating GNAT GPS CE from AdaCore is downloading the new one, installing it and then deleting the old one.
Another thing is to upgrade the gnat-gps that some systems had in ther repositories