adac-header

Generating Ada bindings for C headers (Gem #59) doesn't work any more


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)

  1. g++ -c -fdump-ada-spec -C /usr/include/time.h
  2. 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?


Solution

  • "my installation from AdaCore" - which one?

    It may be that the gcc you pick up doesn’t understand Ada at all. Normally a gcc from an Ada installation knows to delegate compilations to the Ada subsystem.

    You might have better luck with

    gnatmake -c -u -f *.ads