Search code examples
terminaladancursesinteractive

NCurses build environment for Ada 2012 under Ubuntu 19.10


I have an upcoming Ada project (command-line interactive console program) and I would like to use something like ncurses to make screen management simpler.

I have installed the following packages (under Ubuntu 19.10 with latest updates):

  • GNAT 8.3.0
  • libncurses-dev
  • libncursesada-dev
  • libncursesada6.2.20180127
  • libncursesada6.2.20180127-dev

In the "....../libncursesada-doc/examples/" directory there are quite a few demo programs, attempting to build any of them causes complaints such as:

$ gnatmake rain
aarch64-linux-gnu-gcc-8 -c rain.adb
rain.adb:44:06: file "terminal_interface.ads" not found
rain.adb:44:06: "Rain (body)" depends on "Ncurses2.Util (spec)"
rain.adb:44:06: "Ncurses2.Util (spec)" depends on "Terminal_Interface (spec)"
rain.adb:47:06: file "terminal_interface.ads" not found
gnatmake: "rain.adb" compilation error

Does this missing file indicate that this set of packages is broken or have I simply missed one out somewhere?

Or to put it another way, am I barking up the wrong tree with ncurses? Is there a modern alternative that plays nicely with Ada?


Solution

  • This worked for me on Debian 10.

    GNAT version:

    $ gnat --version
    GNAT 8.3.0
    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.
    

    Install:

    $ sudo apt-get install \
      libncurses-dev \
      libncursesada-doc \
      libncursesada6.2.20180127 \
      libncursesada6.2.20180127-dev
    

    Create a new dir:

    $ cd ~
    $ mkdir rain
    $ cd ~/rain
    

    Now build. In this case, we need to provide references to the source dirs using -aI (see also here) and link with libncursesada using -largs -lncursesada (see also here):

    $ gnatmake \
      -aI/usr/share/doc/libncursesada-doc/examples \
      -aI/usr/share/ada/adainclude/ncursesada \
      rain.adb \
      -largs -lncursesada