[gtkada] Building GtkAda git master on OpenSuSE Tumbleweed

Björn Persson Bjorn at xn--rombobjrn-67a.se
Sat Aug 20 16:33:00 CEST 2016


Oliver Kellogg <oliver.kellogg at t-online.de> wrote:
> /usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: cannot find -lgnat-6.1
[...]
> 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

In Fedora we have patched GPRlib to link with "-lgnat-6" instead:

--- a/src/gprlib.adb
+++ b/src/gprlib.adb
@@ -22,6 +22,7 @@
 
 with Ada.Command_Line;  use Ada.Command_Line;
 with Ada.Text_IO;       use Ada.Text_IO;
+with Ada.Strings.Fixed;
 
 with GNAT.Case_Util;            use GNAT.Case_Util;
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
@@ -1154,6 +1155,25 @@ begin
                      GNAT_Version := new String'(Line (6 .. Last));
                      GNAT_Version_Set := True;
 
+                     -- The version numbering scheme changed in GCC 5.
+                     -- If there is a dot in the version, and the part before
+                     -- the dot is 5 or greater, then use only that part in the
+                     -- library names.
+
+                     declare
+                        Pos : Natural := Ada.Strings.Fixed.Index (Line, ".", 6);
+                     begin
+                        if Pos > 0 then
+                           Pos := Pos - 1;  -- the last digit in the first part
+                           if Natural'Value (Line(6 .. Pos)) >= 5 then
+                              Last := Pos;
+                           end if;
+                        end if;
+                     exception
+                        when Constraint_Error =>
+                           null;  -- Not a number? Then let it be.
+                     end;
+
                      Libgnat :=
                        new String'
                          ("-lgnat-" & Line (6 .. Last));


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

I have to add -lm in Fedora too. Does anyone happen to know whether libm
is universally separate from libc, or whether that's a GNU-specific
thing? If it's universal, then -lm should simply be hard-coded in
TestGTK.

Björn Persson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signatur
URL: </pipermail/gtkada/attachments/20160820/9461bdde/attachment.sig>


More information about the gtkada mailing list