Thursday, September 10, 2015

Building Ada programming environment with GCC 5 and GNAT GPL 2015

I would like to rebuild the Ada programming environment based on GCC 5 and GNAT GPL 2015 in Slackware64 14.1, as Ada 2012 support is more mature in GCC 5.

The FSF GCC compiler

At the writing, the latest release of GCC is 5.2.0.  First I update the build script to matched what's in the current tree.  I would to like to replace the stock Slackware64 14.1's compiler with the new one, but GCC changed the default standard C++ library ABI since 5.1.0.  To make it compatible with GCC 4, a configure switch (--with-default-libstdcxx-abi=gcc4-compatible) was added to the build script.  Also, I have changed the build directory to a fixed location to avoid the random location in the original script.  As it is needed for gnat_util build, a fixed location is easier for the script to find the right files.  I had problem on i586 platform, which I had to explicitly add the --disable-multilib switch to the configuration and remove the conditional test for it.  Built and install without problem.

P.S. Due to GPRBuild will look for GNAT's runtime library as libgnat-5.2.so in stead of libgnat-5.so, build script was modified to create the softlink when packaging the GNAT compiler.  Also created libgnarl-5.2.so from libgnarl-5.so

XMLAda

For XMLAda GPL 2015, the default build process is making use of gprbuild, which depends on XMLAda.  I followed what was done on Arch Linux and created a custom Makefile.SlackBuild.  But I installed the package with the following scheme, similar to what GNAT GPL 2015 is doing but with sub-directories for each sub-module:
 usr/include/xmlada
             |- input
             |- unicode
             ...
 usr/lib64/xmlada
           |- input
           |  |- static
           |  `- relocatable
           |- unicode
           |  |- static
           |  `- relocatable
           ...
The document build requires Sphinx, as SlackBuilds.org provides all necessary build scripts, it is a matter of installing the relevant packages and dependencies.

GPRBuild

The 2015 version of gprbuild required gprbuild itself.  So Similar to XMLAda, a custom Makefile was borrowed from the Arch Linux project and modified to suite the needs of Slackware.  My first build was without error, but it failed to build when trying it for gnat_uitl, complained about:
gnat_util.gpr:21:09: warning: no compiler specified for language "C", ignoring all its sources
gnat_util.gpr:21:09: warning: no compiler specified for language "Ada", ignoring all its sources
Further investigation showed that the default target for gprconfig was wrong, it was set to "Slackware" when generating gprconfig-sdefault.ads in my build script, due to not fully understand what it means.  After set it to "$ARCH-slackare-linux", it still failed on linking, looking for GNAT's runtime library libgnat-5.2.so, which does not exist for a standard GCC build, as it only has libgnat-5.so.  After created a soft link from libgnat-5.so, it builds and working.

GNAT_UTIL

The GNAT Util Library provides access to GNAT compiler internals for AdaCore utilities.  The latest release is 5.1.0, since there are no changes on Ada part of the GCC for 5.2.0, it is sufficient for us.  The build went well except for the initial gprbuild target problem.

GTKAda

GTKAda require Gtk+3 version after 3.8.3, the stock version in Slackware 14.1 is 3.8.2, need to upgrade to a latter version.  The version in Slackware current tree is too new, I settled on the latest 3.8 release 3.8.9 and rebuild the GTK+3 package.  The GL support is turned on for this version, but when building test program, it complained:
gtkada-gpl-2015-src/src/lib/gtkada_gl/static/libgtkada_gl.a(gdkgl.o): undefined reference to symbol 'XFree'
/usr/lib/libX11.so.6: error adding symbols: DSO missing from command line
After patching the testgtk.gpr with linker option to link with -lX11 -lm, it built and run fine.

Aunit

Aunit's build script needed to adapt to gprinstall command, other than that, it built smoothly.

GNATColl

GNATColl compiled OK, with minor problem with libgnarl-5.2.so.

GPS

The IDE compiler could be compiled now given all dependencies had been built.  The build did not go smoothly related to some xmlada library issues, back and forth a few times, finally got it compiled.  When running GPS, it gave python script warning about pep8 and jedi, after install those two from SlackBuilds.org, everything is working fine.

Florist

The florist library changed to use gprinstall, which breaks the install process.  After adjust the build script and patched the Makefile.in generated proper project file for used with others, it built and install fine.

Asis

Asis has little problem for installing to correct path, some patch needed to be re-do, after that, everything built and installed correctly.

Gnatmem and Ahven

Gnatmem gave no trouble when compiled for the 2015 version.  Ahven's 2.6 version changed the build process and I had to create a gpr file for it.  Other than that, there is no big problems.

Where are the build scripts

All build scripts are available at GitHub.

No comments: