GNAT 6 experience report (very short)

John Marino has packaged GNAT 6 from FSF for FreeBSD and DragonFly.

I’ve installed FreeBSD with GNAT 6, and tried to see if there were any obvious differences to the older versions (I use GNAT 4.9 and 5 on Debian).

So far the result is that it is more picky about anonymous access types. (Maybe even too picky. I’m trying to figure that out.)

Here is an example:

GNAT 6.0.0 20151129 (snapshot) -=> GNAT AUX [FreeBSD64]
Copyright 1992-2015, Free Software Foundation, Inc.

Compiling: /usr/home/sparre/org.opentoken-6.0b/opentoken-production-parser-lalr-parser_lists.adb
Source file time stamp: 2015-12-10 10:32:39
Compiled at: 2015-12-24 13:56:17

   487.       return (Element => Position.Item'Access);
                                 |
        >>> access discriminant in return aggregate would be a dangling reference

 746 lines: 1 error
gnatmake: "/usr/home/sparre/org.opentoken-6.0b/opentoken-production-parser-lalr-parser_lists.adb" compilation error

The subroutine which causes the problem is:

   480     function Constant_Reference
   481       (Container : aliased in List'Class;
   482        Position  : in Parser_Node_Access)
   483       return Constant_Reference_Type
   484     is
   485        pragma Unreferenced (Container);
   486     begin
   487        return (Element => Position.Item'Access);
   488     end Constant_Reference;

Switching to 'Unrestricted_Access makes the compiler accept the function, but is it safe?

(Debian/experimental also has GNAT-6.)

GNAT AUX Synced With GCC 4.6.3

The DragonLace project is still going strong, and a little over a week ago they synced the GNAT AUX compiler with GCC 4.6.3:

GCC 4.6.3 was released on 1 March 2012. Due to recent work on the gnat-aux package, it was relatively easy to update the pkgsrc version of gnat-aux to version 20120301 which syncs with GCC Release 4.6.3. It has already been tested and committed to the pkgsrc CVS trunk.

It wasn’t all sunshine and happy bananas though, as there was some trouble getting it to work properly with FreeBSD 9.x. The DragonLace people are on it though, and if things pan out as they usually do, they will have everything solved soon ™.

You can read the full post about the update here

GNAT AUX for OpenIndiana

First the OpenIndiana project ported KVM, and now the DragonLace guys have made GNAT AUX available for this new Solaris based OS:

I had previously built a flawless GNAT-AUX on an obsolete OpenSolaris version SXCE 130. It was fairly trivial to built a static bootstrap compiler on the latest version of OpenIndiana (oi_151a). The lang/gnat-aux package has been updated to support the x86 Solaris target, and also updates all supported platforms to provide working runtime symbolic traceback. It just missed the 2011Q3 branch, so it’s only available in the pkgsrc trunk.

Awesome!

OpenIndiana is looking better and better. The now defunct OpenSolaris project was pretty interesting, but very rough around the edges. OpenIndiana already seems much more polished and with Ada now available on the platform, I’m drawn to do some testing.

Zero Testsuite Failures for GNATDroid = Ada on Android

The DragonLace project is at it again! John Marino has acquired an Android device and, after building GNATDroid-ARMv7, has confirmed that he could compile Ada programs on FreeBSD and execute them on the Android tablet.

That is just awesome news, both for FreeBSD users and Ada programmers in general. The work done by John is simply amazing.

You can read the entire announcement here.

FreeBSD-8.2 and GNAT AUX – initial impressions

Over the past months I’ve written a few posts about the dragonlace.net project, which aims to bring the GNAT Ada compiler to the *BSD world and Solaris world.

They call their compiler GNAT AUX.

It is, as I’ve stated in previous posts, an impressive feat that GNAT AUX is now available for more or less all their targets.

So I decided to stop just reporting on the progress of GNAT AUX, and instead try it out myself. I’m more or less a complete BSD beginner, so the ride was somewhat bumpy due to me fumbling around. I chose FreeBSD-8.2 as my testing ground, and while it felt a lot like my dear and beloved Slackware, it was also sufficiently different to allow for a few “DUH!” moments as I learned the ropes. The _excellent_ FreeBSD online manual was a great help. I wish all operating systems had such a nice and concise manual.

With FreeBSD-8.2 up and running I installed the GNAT AUX port, and it just worked. It compiled cleanly without a hitch, and when it was done I had a nice Ada compiler running:

GNATMAKE 4.6.0 20110107 (experimental) -=> GNAT AUX [FreeBSD64]

Awesome!

Next up I grabbed the AWS port, and that too worked out of the box.

I even tried compiling AWS using the latest Git checkout

git clone --recursive http://forge.open-do.org/anonscm/git/aws/aws.git

And that too worked, almost, out of the box. I merely had to use “gmake” instead of “make”.

Two down, three to go.

I’m a big fan of GNATColl, so naturally I had to try and compile that also. There’s currently no port of GNATColl, so I had to do that manually. I grabbed the latest SVN checkout

svn co http://svn.eu.adacore.com/anonsvn/Dev/trunk/gps/gnatlib/

And compiled it according to instructions, except I needed to substitute “make” with “gmake”, just as with AWS.

I had a bit of trouble getting GNATColl to find my PostgreSQL installation, but that turned out to be because I’d installed the wrong PostgreSQL port. As soon as I installed the right one (postgresql-libpqxx) it worked. GNATColl compiled without a hitch. How very nice!

Last on the block was Florist, the Ada binding to POSIX. This is available from libre.adacore.com, and this too compiled without a hitch.

Everything appeared to be working just fine.

But then I tried the hello_world demo program that comes with AWS, and that did not go well. It compiled just fine, but when I tried to start it, it complained about a missing aws.ini file. I created that file, and then it complained about a missing hello_world.ini file. I also created that and silently hoped that the third try would be a success. Sadly it was not:

raised GNAT.SOCKETS.SOCKET_ERROR : [36] Operation now in progress

At that point I decided to give up on hello_world and instead try building my own AWS based web toolbox. It’s just a simple little project I’m working on, as a part of the ongoing effort of getting rid of PHP in my shop.

I grabbed the software and tried compiling it using plain gnatmake:

yolk-process_control.ads:99:63: "SIGPWR" not declared in "Names"

Hmm, not a good sign. I got rid of the offending “SIGPWR” handler and tried again, and now it compiled without issue. YAY!

I then tried running the demo application and got this:

Execution terminated by abort of environment task

I suspect maybe this has something to do with the fact that I setup my own signal handlers in the application, using the Ada.Interrupts.Names package.

Or maybe it’s because I use Florist/POSIX to switch user when the application start.

I don’t know, and I haven’t had time to investigate further.

So what have I learned from this experience:

  1. GNAT AUX is easy to install, and so is the rest of the dragonlace.net Ada port packages.
  2. AWS, GNATColl, Florist and my own toolbox compiles fine using GNAT AUX.
  3. The AWS hello_world demo and my own AWS application won’t run out of the box.

I’m very impressed with how easy it has been to get my usual Ada environment up and running on FreeBSD-8.2, and I’m not at all convinced that the errors I’m getting when trying to run the AWS hello_world and my own AWS application is not due to my own fault. I will have to investigate further, when time permits.

DragonLace and Ada Support on *BSD / *Solaris / Android

In a lengthy post to comp.lang.ada John Marino of DragonLace fame outlines the current status of Ada support for *BSD, *Solaris and Android.

And things are looking pretty good:

For a long time, support for Ada was poor to non-existent for the four major BSD platforms of FreeBSD, NetBSD, DragonFlyBSD, and OpenBSD. GNAT would not build from source, although FreeBSD i386 was pretty close. Over the last year, I’ve developed a substantial set of patches and now GNAT from GCC-4.6 passes the entire ACATS and gnat.dg testsuite without failure on FreeBSD, DragonFlyBSD, and NetBSD on both the AMD64 and i386 platforms. The version is called “GNAT-AUX” and it also builds on OpenBSD with only a single failure the same two platforms.

The amount of work that has gone into this is amazing, and I personally look forward (very much!) to the day where Android apps can be build using Ada. How cool would that be?

If you visit the DragonLace website, you’ll see that the project is only 3 measly failures away from having achieved perfect status for its GNAT AUX port project.

I think I’m going to have to install one or more BSD’s and start testing my own AWS powered web tool box!

This project is a _huge_ boon to the Ada community.

GNAT AUX Ported to Android

Building Android applications in Ada is no longer a faraway dream, now that the DragonLace project has managed to successfully built the GNAT AUX cross compiler Android.

This is very exciting news indeed, and seeing a screenshot of an Ada hello world program running in the Android SDK is just amazingly cool.

But don’t take my word for it – go read the full announcement instead.

*BSD + Ada Just Got Better

With this announcement, using Ada on a *BSD system suddenly became a _very_ viable option.

I don’t know how fast the FreeBSD Ports community work, but it probably wont take several months before GNAT-AUx, XML/Ada, GPRBuild, GTK/Ada, GPS, GNATPython, and AWS are available to FreeBSD users.

The same packages were also added to the NetBSD’s pkgsrc repositories.

Once again the people over at dragonlace.net must be commended for their gargantuan effort in bringing Ada to the *BSD’s.

DragonLace FreeBSD64 update

The good people at dragonlace.net have run into some issues with GNAT AUX on FreeBSD64:

At this point, the FreeBSD64 version of GNAT AUX is probably only suitable for helloworld type programs if that.

That should more or less say it all.

Hopefully they’ll figure out what’s wrong, and have it fixed, so all you FreeBSD64 users also can enjoy your Ada.