When I used this method a few years ago, with Ada from the Ubuntu repository, it worked fine. Now, with my installation from Adacore, not so anymore.
The method consists of 2 commands (time.h as example)
- g++ -c -fdump-ada-spec -C /usr/include/time.h
- gcc -c -gnat05 *.ads
While the first command executes without any problem, the second one returns:
gcc: fatal error: cannot execute ‘gnat1’: execvp: No such file or directory
It doesn't depend on the -gnat05 option. There is indeed no gnat1 in the bin directory of the Ada installation. Mine is version 2021. I am reluctant to install the GNU version in parallel, I might mix up things.
Any other idea?
"my installation from AdaCore" - which one?
It may be that the
gcc
you pick up doesn’t understand Ada at all. Normally agcc
from an Ada installation knows to delegate compilations to the Ada subsystem.You might have better luck with
-c
- compile only, even if it looks like a main unit-u
- just this unit, not the closure-f
- compile even if Ada’s rules mean it doesn’t need it