Gprbuild cannot find compilers

To build and install gprbuild, I have followed the instructions from GitHub - AdaCore/gprbuild: GPRbuild is an advanced build system designed to help automate the construction of multi-language systems. · GitHub .

The prefix has been set to /opt (so as to match the installation location of gcc, gnat, etc.). The $PATH indeed includes /opt.

However, it does not appear that gprconfig is able to find a compiler.

Here is the output from “gprconfig -vv”:

Parsing knowledge base at /opt/share/gprconfig
Directory not found: /opt/share/gprconfig
Only compilers matching target x86_64-pc-linux-gnu will be preserved
create a new target set for x86_64-pc-linux-gnu
Will examine P /opt/bin
Will examine P /usr/local/sbin
Will examine P /usr/local/bin
Will examine P /usr/bin
Will examine P /home/jpl/bin
Will examine P /home/jpl/.local/bin
Will examine P /home/jpl
Foreach compiler in /opt/bin regexp=FALSE extra_dir=FALSE
Foreach compiler in /usr/local/sbin regexp=FALSE extra_dir=FALSE
Foreach compiler in /usr/local/bin regexp=FALSE extra_dir=FALSE
Foreach compiler in /usr/bin regexp=FALSE extra_dir=FALSE
Foreach compiler in /home/jpl/bin regexp=FALSE extra_dir=FALSE
Foreach compiler in /home/jpl/.local/bin regexp=FALSE extra_dir=FALSE
Foreach compiler in /home/jpl regexp=FALSE extra_dir=FALSE
List of targets supported by a compiler:
No compilers found for target x86_64-pc-linux-gnu

output of “which gnat” yields:
/opt/bin/gnat

It is interesting that the message above mentions “/opt/share/gprconfig” (which does NOT exist), but there IS a file called “_default.gpr” in “/opt/gpr”. The listing of that _default.gpr file consists of only two lines:

standard project Default is
end Default;

How shall I best proceed to figure out the issue here and enable gprbuild to find the compilers?

Hi,

I remember when I built/bootstrapped gprbuild, when you do the first build (the bootstrap), it installs the “knowledge” (gprbuild_kb) files. But when you went ahead and built gprbuild using gprbuild itself, it would not install the knowledge files. Maybe your “share” folder does not exist because the bootstrapping process did not create it and did not install the knowledge files. Without those files, gprbuild cannot move forward beyond the very basics, which is the behaviour you are now getting.

Best regards,
Fer

Ahhhh, that is a good clue. It also explains a number of other things that I had noticed.

So, the question I ask myself, is: “When doing the bootstrapping build, should I have also used the same “prefix” that the later (i.e. non-bootstrapping) build would use?”

I had assumed that this knowledge base was just needed for the bootstrapping build. But, that assumption may be wrong.

Thanks for you reply. I will explore this route.

Fer, Thanks for MILLION for pointing me in the right direction. All is working perfectly now. Perhaps it should have been obvious to me earlier, but I was completely baffled.

No worries, I honestly think that the proper gprbuild should also install the knowledge db, but it does not. Maybe this should be fixed upstream, but it has been years/forever that this has been the behaviour… :confused: I also spent waaaaay too much time debugging this.

Happy hacking,
Fer