comp.lang.ada
 help / color / mirror / Atom feed
* Gnat Installations
@ 1996-03-22  0:00 Kenneth Mays
  0 siblings, 0 replies; only message in thread
From: Kenneth Mays @ 1996-03-22  0:00 UTC (permalink / raw)


This is from Jamil Molik from Fresno.edu,India on Gnat installations.
From his web page, he is from India and taking computer science courses.
By the way, GNAT is at V3.03 and Solaris is now at V2.5. - Ken
 

INTRODUCTION

The following major features were looked for in an Ada Compiler
before we decided to install it.
	It should be free.
	It should be standard.

We decided to use the GNU GNAT Ada Compiler. One of the
motivations was that along with installing the GNU Ada compiler, we
could also install the C - compiler. We had good old gcc c 2.4
on our machines and it seemed to be the right time to
upgrade/install gcc 2.7.

The GNU Ada Translator (GNAT) is an Ada 95 front end for the
Free Software Foundation's GCC compiler. The GCC back-end is a
large program (about 300,00 lines of C) that generates extremely
high quality code. 
The GNAT system has three components. The first is the front-end
proper, which is written entirely in Ada 83, and which parses
and analyzes Ada-9X text to generate an intermediate tree form.
A small but critical C - program, called Gigi (which stands for
"Gnat to Gnu"), transforms this tree into the form required by
the GCC back-end, essentially mapping the semantics of Ada into
those of C.
The second component involves modifications to the GCC back-end
itself to support some very important aspects of Ada semantics
(such as checked arithmetic, variant record types, and exception
handling) that do not map easily into C.
The third component is the runtime -- the most important part of
which is the tasking module that must support the new real-time
features of Ada 95: protected types, asynchronous transfer of
control, requeue, and the real-time annex. The development team
defined a high-level interface from the compiler-generated code
to this runtime, and a low-level interface from the runtime to
the target environment. The low-level interface is suitable for
implementation on top of an operating system, such as one that
supports POSIX threads, or one that can be directly mapped onto
bare-board hardware. The runtime library that implements the
connection between these two open interfaces is written entirely
in Ada.

INSTALLATION PROCEDURE

I started with the getting the readme file. Learned that there
are versions for Unix (various systems)in addition to versions
for Windows NT, OS/2 and DOS.

The original plan was to install Ada on the machines in the grad
lab. Mark could not get gcc 2.7 required to compile Ada and
hence i tried to do the same on the Linux stations but
unsuccessfully. We had some components of gcc on linux missing.

Initially, we decided to get the source for gcc 2.7 and compile
it. But then we discovered that we needed gcc 2.6.2 minimum to
compile gnat. So we instead decided to go for the binary
versions.

We decided to install on the Sun Sparc stations
Solaris 2.3. The assumption here is that we first get it
up and running on these machines and then port it to SunOS
(osiris/satyrs). 
The ftp site that we obtained the GNU-NYU Ada Translator was
cs.nyu.edu.

The binary distribution is available in the file
gnat-2.06-sparc-sun-solaris2.3-bin-tar-gz.

The instructions for installation are in the file README.
Now, this binary installation needed some patch files and they
could go only with either gcc 2.6.2 or gcc 2.6.3. We had none
and the patch files for gcc 2.7 were not available. So the only
option was to install gcc 2.7 with the option to compile c as
well as ada files.

Installation of gcc 2.7.0 binary was not that bad. The way the process
works is that the native compiler is used to create the stage1 
compiler which is then used to create the stage2 compiler (if i
got this right). We had to make some changes to our path (like
make sure /usr/ucb was after /usr/bin, for eg.) and then do the
'configure' command. We did not have to specify any options to the
command as the host and the target machine were the same.
The next step was to build the compiler. Just type 'make
languages = c ada' in the compiler directory. After this, we have
the 1st stage object files. We then recompile the compiler with
itself, with the command:
'make cc ="stage1/xgcc -Bstage1/"CFLAGS="-g -O"

this is called making the stage2 compiler.
then we made the stage3 compiler doing
'make stage2'
'make CC="stage/xgcc -Bstage2/"CFLAGS ="-g -O'

then compare the latest object files with the stage 2 object
files - they ought to be identical. this is done with 'make
compare' command. the stage 3 part is repeated until the object
files of the two stages match.

Install the compiler driver, the compiler's passes and run-time
support with 'make install'. Use the same value for CC, CFLAGS,
and LANGUAGES that you used when compiling the files that are
being installed.

After installing the stage 2 compiler, you can use the following
command:
make install CC ="stage2/xgcc -Bstage2/" CFLAGS ="-g -o"
LANGUAGES = "LIST"

This copies the files 'cc1', 'cpp' and 'libgcc.a' to required
locations. The driver program xgcc is also copied into
/usr/local/bin/gcc so that it appears in typical execution
search paths.

This takes care of Ada and C 2.7 compiler installation.

RUNNING GNAT

Three steps are needed to create an executable file from an Ada
source file: it must first be compiled, it must then go through
the gnat binder, and then all appropriate object files it needs
are then linked together to produce and executable. A tool has
been provided to combine the last two steps into one command.

The first step is the same as for c programs.
e.g.
if the source file is hello.adb (adb is the extension for Ada
files), then we compile it by
	gcc -c hello.adb
Binding and linking object files is done together by the
command:
	gnatbl -o hello hello.ali

This creates the executable hello.

Example codes are on triton (the sparc server, same as satyrs)
in the path

/usr/local/src/gnat-2.06-src/examples/

You need to copy all the examples to your home or to the tmp
directory before you run them. Use make to create executables,
or you can try the examples on your own.

More information on how to use gnat is in the file gnatinfo.txt.




- Gnat info. 




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-03-22  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-22  0:00 Gnat Installations Kenneth Mays

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox