I am trying to compile GCC 8.5.0 from source in UBI8. Specifically, I want to build GNAT alongside it. Starting with the Docker image
redhat/ubi8
I install the required packages
dnf install -y gcc-gnat gcc-c++ gmp-devel mpfr-devel libmpc-devel
and download the source code of GCC 8.5.0 (same version as the system compiler) from the GNU website.
I unzip, make the build directory, and run configure from there. Most flags are irrelevant here, but I am adding ada to the build:
../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto,ada ...
And I get this error:
configure: error: GNAT is required to build ada
Clearly gnat
is installed:
# gnat --version
GNAT 8.5.0 20210514 (Red Hat 8.5.0-21)
Copyright (C) 1996-2018, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So what’s happening? gcc
appears to not have been built with the ada frontend so it does not understand ada files. As seen here
# touch a.adb
# gcc -c a.adb
gcc: error: a.adb: Ada compiler not installed on this system
Which begs my question: is it at all possible to build GNAT using the system compiler? I was able to on CentOS7 since the package there had the frontend built in, however here it seemingly does not