[gtkada] Building GtkAda git master on OpenSuSE Tumbleweed

Oliver Kellogg oliver.kellogg at t-online.de
Sat Aug 13 23:55:32 CEST 2016


Hi,

Here are some experiences I had while building GtkAda on Tumbleweed.

Tumbleweed comes with the following GNAT:
$ gnatls --version
GNATLS 6.1.1 20160707 [gcc-6-branch revision 238088]
Copyright (C) 1992-2016, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Apparently `gprbuild` and `gprinstall` are not included in the FSF compiler.
I downloaded the gprbuild from GPL-2016 and after installation in /usr did the following:
$ su
$ cd /usr/bin
$ mv gprbuild gprbuld-2016
$ echo -e '#!/bin/bash\ngprbuild-2016 --RTS=/usr/lib64/gcc/x86_64-suse-linux/6 $*' > gprbuild
$ chmod a+x gprbuild
$ mv gprinstall gprinstall-2016
$ echo -e '#!/bin/bash\ngprinstall-2016 --RTS=/usr/lib64/gcc/x86_64-suse-linux/6 $*' > gprinstall
$ chmod a+x gprinstall

`configure` was then happy; however, during `make` there was an error compiling src/opengl/gtkglarea.c:

In file included from /usr/lib64/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /home/okellogg/tools/gtkada/src/opengl/gdkgl.h:23,
                 from /home/okellogg/tools/gtkada/src/opengl/gtkglarea.c:22:
/usr/include/gtk-3.0/gtk/gtk-autocleanups.h:86:31: error: unknown type name ‘GtkGLArea’
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGLArea, g_object_unref)

I realized I should check what version of gtk is installed:
$ pkg-config gtk+-3.0 --modversion
3.20.6

AFAICT GtkAda currently is tested with gtk 3.14 ...

Since I am not using the Gtk openGL stuff I got adventurous and made the following change (hack alert!)

diff --git a/src/opengl/gtkglarea.h b/src/opengl/gtkglarea.h
index 5037b30..7f9b54a 100644
--- a/src/opengl/gtkglarea.h
+++ b/src/opengl/gtkglarea.h
@@ -21,6 +21,8 @@
 #ifndef __GTK_GL_AREA_H__
 #define __GTK_GL_AREA_H__

+typedef struct _GtkGLArea       GtkGLArea;
+
 #include <gdk/gdk.h>
 #include <gdkgl.h>
 #include <gtk/gtk.h>
@@ -36,7 +38,6 @@ G_BEGIN_DECLS
 #define GTK_GL_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GL_AREA, GtkGLArea))


-typedef struct _GtkGLArea       GtkGLArea;
 typedef struct _GtkGLAreaClass  GtkGLAreaClass;


With that change, compilation proceeded for a while but then I got another error:

gcc -shared -o /home/okellogg/tools/gtkada/src/lib/gtkada/relocatable/libgtkada.so.17.0w ... @/home/okellogg/tools/gtkada/src/obj/gtkada/relocatable/GNAT-TEMP-000006.TMP
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: cannot find -lgnat-6.1
collect2: error: ld returned 1 exit status
gprlib: /usr/bin/gcc execution error
gprbuild: could not build library for project gtkada
make: *** [Makefile:85: build_library_type/relocatable] Error 4

I guess that is a missing soft link in openSuSE's GNAT installation:

sudo ln -s /usr/lib64/libgnat-6.so /usr/lib64/libgnat-6.1.so

libgtkada.so could then be linked.
After a while there was yet another error:

gcc -c b__testgtk.adb
ar cr libtestgtk.a ...
ranlib libtestgtk.a
gcc testgtk.o -lGLU -lGL -L/home/okellogg/tools/gtkada//lib -L/home/okellogg/tools/gtkada//bin -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lfontconfig -lfreetype -o testgtk
gcc test_rtree.o -lGLU -lGL -L/home/okellogg/tools/gtkada//lib -L/home/okellogg/tools/gtkada//bin -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lfontconfig -lfreetype -o test_rtree
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: libtestgtk.a(lw.o): undefined reference to symbol 'sqrtf@@GLIBC_2.2.5'
/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
gprbuild: link of testgtk.adb failed
make: *** [Makefile:98: tests] Error 4

In shared.gpr at the generated definition of Gtk_Libs, I manually added "-lm":

gcc testgtk.o -lGLU -lGL -L/home/okellogg/tools/gtkada//lib -L/home/okellogg/tools/gtkada//bin -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lfontconfig -lfreetype -lm -o testgtk
gcc test_rtree.o -lGLU -lGL -L/home/okellogg/tools/gtkada//lib -L/home/okellogg/tools/gtkada//bin -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lfontconfig -lfreetype -lm -o test_rtree
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: /home/okellogg/tools/gtkada/src/lib/gtkada_gl/static/libgtkada_gl.a(gdkgl.o): undefined reference to symbol 'XFree'
/usr/lib64/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Again in shared.gpr at Gtk_Libs I added "-lX11" and then the build went successful.

This GtkAda build has been working fine for my purposes.

Oliver



More information about the gtkada mailing list