One of my students wanted to to compile Ada  on Ubuntu for a project he is working with. He came to me for help. But Ada is like Chinese to me. How ever I  managed to compile a simple hello world program. as below on Ubuntu 9.04

  1. Install GNAT (GNU New York University Ada Translator):
  2. sudo apt-get install gnat
  3. Here is the hello.adb
  4. with Ada.Text_IO;
     
    procedure Hello is
     begin
     Ada.Text_IO.Put_Line("Hello, world!");
     end Hello;
  5. And use this command to compile:
  6. gnat make hello.adb

    You will get hello.ali and a binary hello in your home directory.

Alternately you can split the steps

  1. Run gcc to compile to object file:
  2. gcc -c hello.adb
  3. Run gnatbind to produce binder output:
  4. gnatbind hello.ali
  5. Run gnatlink to link and produce executable output:
  6. gnatlink hello

Tags: