Z's space

2012-04-15

Building an Ada development environment using FSF GCC for Slackware

Filed under: Ada programming,Programming — by zhuqy @ 12:04
Tags: , , , , , , ,

Ada support in Slackware is minimum, there is nothing else to help the Ada programer except the stock gnat compiler.   My goal is to make GPL version of GNAT GPS released from AdaCore to work with FSF released GCC.

Debian has excellent gnat/Ada program maintainers and they had done a great job.  But then I always like the Slackware way of doing things not the Debian way.   My work are based on their hard work.

At first,  I tried to make the package to follow the Debian policy for Ada, but then I need to change quite intrusively to the original package.  And somehow I don’t like the way it place the library and include files.  Since this is Slackware, in the spirit of it, I tend not to change the original package too much unless it is really necessary.  The directory structure come out roughly  like the following:

/usr/include/package-name/  -- for include .adb and .ads files
/usr/lib<64>/package-name/ -- for .ali files
/usr/lib<64>/gnat/package-name.gpr

Now start building packages.  The gcc compiler in Slackware 13.37 is a little bit old for Ada language support, and it happened that build script for  gcc4.7.0 just shown up in the slackware-current tree.   I downloaded the whole source tree for gcc-4.7.0 from slackware-current and start to modified it.  I tried to mimic what Ludovic Brenta has done on Debian and build two libraries (libgnatprj/libgnatvsn) from the compiler source directly,  so that they could be reused latter for asis and gps.  His patched are quite intrusive and does not apply well as it is mean for 4.6.  I examined the patch and extracted what I needed and form two Makefiles for building libgnatprj and libgnatvsn without modified the gcc source tree itself.  It built fine first, but has linking error when try to build other packages.  It took me more than 10 builds of the compiler to make it working fine.  I haven’t took the time to compile a sjlj run time, as I don’t have a need for it yet.

Then I compiled XmlAda using the xmlada-for-gps-5.0.1-gpl-src.tgz source.  This required not much an effort.   I use the svn checkout of the GtkAda and it fixed some path problem I reported, so no patch is needed (actually, it does have a small patch to relax the path configuration).  The gprbuild program gave some challenge, as it compiled OK but failed to build Ada program.  It turns out to be a configuration xml problem, it has hard coded some lib path into it and does not acknowledge the path given during configure.

GPS is also from svn checkout.  Compiling GPS took a few round, patches are mostly for path correction and some from the Debian team.  It was compiling GPS that exposed the linking error about unresolved symbol for libgnatprj, it took me quite a few recompile of the library and compiler to get it working.

The rest are relatively easy for florist, aunit, gnatcoll, asis,etc.

The build scripts, source and pre-build binary packages for Slackware64 could be found here: goo.gl/osOED.

The build scripts could also be found at gitHub ada-4-slackware.

ps. I only tested on Slackware64 13.37, it supposed to work fine with 32-bit Slackware, but I did not test it.

pps. The svn checkout of GtkAda and GPS are using git svn clone, so it has the git version in the build tag and source file in stead of svn build number.

pps. I felt obligated to match Thomas’ kind words on Ada On Slackware64, the above link at goo.gl/osOED now really contain pre-build binaries for Slackware64. It fixed some problems with the build tar balls, some of them does not contain source tar ball. Note that it contains binutils build from slackware64-current source in order to compile gnatmem, it also contains the oprofile due to new binutils.

Blog at WordPress.com.