skip to Main Content

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

enter image description here

You can see that the version I’m using is 4.8.5

enter image description here

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


  1. You don’t need to install a compiler, you already have 3 (at least):

    • gcc 4.8.5 (the system compiler) in /usr/bin
    • gcc 7.3.0 (that you just built) in /usr/local/bin
    • gcc 8.3.1 (from GNAT CE 2019) in /home/parallels/opt/GNAT/2019/bin

    Your PATH determines which GCC you pick up when you say just gcc, and which GNATLS you pick up when you say just gnatls, .. etc.

    According to a previous post, your PATH is:

    $ echo $PATH
    /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/var/lib/snapd/snap/bin:/home/parallels/.local/bin:/home/parallels/bin/home/parallels/opt/GNAT/2019/bin/home/parallels/opt/GNAT/2019/bin
    

    so when you say just gcc the system looks at the first entry in the PATH (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 (type ps -p $$, should come back with bash 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 of PATH and immediately after that line insert

    export PATH=/home/parallels/opt/GNAT/2019/bin:$PATH
    

    Open a new terminal window and say e.g. gnatls -v – you should pick up the GNAT CE 2019 one.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search