comp.lang.ada
 help / color / mirror / Atom feed
* static GtkAda
@ 2004-08-25 17:22 Adrian Knoth
  2004-08-25 17:55 ` Ludovic Brenta
  0 siblings, 1 reply; 10+ messages in thread
From: Adrian Knoth @ 2004-08-25 17:22 UTC (permalink / raw)


Hi,

is it possible to make a static binary of a GtkAda-application
under Debian unstable?

It's just a "I never needed that but now there's a bad hurry"-
question. I tried largs, cargs, bargs with -static, gtkada-config
with -static-flag, but the result isn't a static binary. Linking
fails.


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Q: Was haben ein Computer und eine Frau gemeinsam?
A: H�tte man noch ein halbes Jahr gewartet, g�be es was Besseres!



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 17:22 static GtkAda Adrian Knoth
@ 2004-08-25 17:55 ` Ludovic Brenta
  2004-08-25 18:55   ` Georg Bauhaus
  2004-08-25 20:10   ` Adrian Knoth
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Brenta @ 2004-08-25 17:55 UTC (permalink / raw)


Adrian Knoth writes:
> Hi,
>
> is it possible to make a static binary of a GtkAda-application
> under Debian unstable?
>
> It's just a "I never needed that but now there's a bad hurry"-
> question. I tried largs, cargs, bargs with -static, gtkada-config
> with -static-flag, but the result isn't a static binary. Linking
> fails.

Of course.  I always recommend GNAT project files.  You can do
something like this:

with "/usr/share/ada/adainclude/gtkada2.gpr";
project My_Static_Project is
   ...
   package Linker is
      for Default_Options ("Ada") use
         ("/usr/lib/libgtkada2.a",
          "/usr/lib/libgnomeada2.a",  -- if required
          Other_Libs);
   end Linker;
end My_Static_Project;

The trick is the Other_Libs.  If you link GtkAda statically, you need
to specify excplicitly all the other libraries that GtkAda requires.
You can choose static or dynamic linking for these other libraries.
On my system, ldd /usr/lib/libgtkada2.so yields an impressive list of
libraries that libgtkada2 depends on, directly or indirectly:

libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x402ab000)
libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x4057e000)
libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x405f0000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x4060b000)
libm.so.6 => /lib/libm.so.6 (0x40620000)
libpangoxft-1.0.so.0 => /usr/lib/libpangoxft-1.0.so.0 (0x40642000)
libpangox-1.0.so.0 => /usr/lib/libpangox-1.0.so.0 (0x40647000)
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x40653000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x40689000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x406c3000)
libdl.so.2 => /lib/libdl.so.2 (0x406c7000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x406ca000)
libgnat-3.15p.so.1 => /usr/lib/libgnat-3.15p.so.1 (0x40749000)
libc.so.6 => /lib/libc.so.6 (0x408de000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40a12000)
libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40ad9000)
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40add000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40ae5000)
libXft.so.2 => /usr/lib/libXft.so.2 (0x40af3000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x40b05000)
libz.so.1 => /usr/lib/libz.so.1 (0x40b73000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x40b84000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x40bab000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x40bb4000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x40bbc000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x40be2000)

If you link dynamically against, say, libgtk-x11-2.0.so, you will
automatically get some of these for free.

PS. The -static argument to the binder just says to link libgnat and
libgnarl statically; it does not affect the other libraries.

PPS. Note that the GtkAda static library contains debugging symbols
and is almost 15 megabytes in size.  Your executable will be very big,
so you'll probably want to strip it.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 17:55 ` Ludovic Brenta
@ 2004-08-25 18:55   ` Georg Bauhaus
  2004-08-25 19:08     ` Ludovic Brenta
  2004-08-25 20:10   ` Adrian Knoth
  1 sibling, 1 reply; 10+ messages in thread
From: Georg Bauhaus @ 2004-08-25 18:55 UTC (permalink / raw)


Ludovic Brenta <ludovic.brenta@insalien.org> wrote:

: project My_Static_Project is
:   ...
:   package Linker is
:      for Default_Options ("Ada") use
:         ("/usr/lib/libgtkada2.a",
:          "/usr/lib/libgnomeada2.a",  -- if required

I was wondering whether libgtkada2-dev could be made independent of
libgnome2-dev, as this dependence creates a host of 2nd level GNOME
dependence for all Debian GtkAda applications?


-- Georg



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 18:55   ` Georg Bauhaus
@ 2004-08-25 19:08     ` Ludovic Brenta
  2004-08-26 11:15       ` Georg Bauhaus
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Brenta @ 2004-08-25 19:08 UTC (permalink / raw)


Georg Bauhaus writes:
> Ludovic Brenta wrote:
>
> : project My_Static_Project is
> :   ...
> :   package Linker is
> :      for Default_Options ("Ada") use
> :         ("/usr/lib/libgtkada2.a",
> :          "/usr/lib/libgnomeada2.a",  -- if required
>
> I was wondering whether libgtkada2-dev could be made independent of
> libgnome2-dev, as this dependence creates a host of 2nd level GNOME
> dependence for all Debian GtkAda applications?

This was done a few days ago; see bug #258733.  libgtkada2_2.2.1-5
fixes it, and has been in unstable for 16 days now [1].  There are now
two -dev packages, libgtkada2-dev and libgnomeada2-dev, and
libgtkada2-dev has reduced dependencies.  If you are using Sarge, wait
a couple of days more because libgtkada2_2.2.1-5 is waiting for
libgnome and gnome-vfs2.

[1] http://bjorn.haxx.se/debian/testing.pl?package=libgtkada2

Note that this concerns only package dependencies; even in 2.2.1-4,
libgnomeada2.{so,a} is separate from libgtkada2.{so,a} and you don't
have to use it.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 17:55 ` Ludovic Brenta
  2004-08-25 18:55   ` Georg Bauhaus
@ 2004-08-25 20:10   ` Adrian Knoth
  2004-08-25 20:19     ` Florian Weimer
  1 sibling, 1 reply; 10+ messages in thread
From: Adrian Knoth @ 2004-08-25 20:10 UTC (permalink / raw)


Ludovic Brenta <ludovic.brenta@insalien.org> wrote:

>    package Linker is
>       for Default_Options ("Ada") use
>          ("/usr/lib/libgtkada2.a",
>           "/usr/lib/libgnomeada2.a",  -- if required
>           Other_Libs);
>    end Linker;
> end My_Static_Project;
>
> The trick is the Other_Libs.  If you link GtkAda statically, you need

It took me some time to figure out that "Other_Libs" is not a predefined
variable. But grepping through the gcc-CVS showed it ;)

And the line is "Default_Switches", not Default_Options. I managed
to build the application with the following settings:

   package Linker is
      for Default_Switches ("Ada") use
         ("--static",
          "/usr/lib/libgtkada2.a",
          "/usr/lib/libgtk-x11-2.0.a",
          "/usr/lib/libgdk-x11-2.0.a",
          "/usr/lib/libatk-1.0.a",
          "/usr/lib/libgdk_pixbuf-2.0.a",
          "/usr/lib/libm.a",

          "/usr/lib/libpangoxft-1.0.a",
          "/usr/lib/libpangox-1.0.a",
          "/usr/lib/libpango-1.0.a",
          "/usr/lib/libpangoft2-1.0.a",

          "/usr/lib/libgobject-2.0.a",
          "/usr/lib/libgmodule-2.0.a",
          "/usr/lib/libglib-2.0.a",
          "/usr/lib/libdl.a",
          "/usr/X11R6/lib/libXrandr.a",
          "/usr/X11R6/lib/libXi.a",
          "/usr/X11R6/lib/libXext.a",
          "/usr/lib/libXft.a",
          "/usr/lib/libfontconfig.a",
          "/usr/lib/libpthread.a",
          "/usr/lib/libc.a",
          "/usr/lib/libjpeg.a",
          "/usr/lib/libtiff.a",
          "/usr/lib/libpng.a",
          "/usr/lib/libz.a",
          "/usr/lib/libfreetype.a",
          "/usr/lib/libXcursor.a",
          "/usr/lib/libXrender.a",
          "/usr/X11R6/lib/libXinerama.a",
          "/usr/X11R6/lib/libX11.a",
          "/usr/lib/libexpat.a");

   end Linker;

And there are other things I didn't know: it's not sufficient to
include all the static libraries it's also important in which *order*
you mention them. This order above works, if you move some of
the libs below (let's say libz) to the beginning of the list the
linking process fails. Until now I don't know why. Someone else?

> libraries that libgtkada2 depends on, directly or indirectly:

Unfortunately it also requires libs which are neither directly
nor indirectly mentioned in the .so-versions. Ok, I might have
missed some libs but ldd to the so-libs never gave me libtiff
or libpng.

> PPS. Note that the GtkAda static library contains debugging symbols
> and is almost 15 megabytes in size.  Your executable will be very big,
> so you'll probably want to strip it.

My executable is <9MB, that's ok (the machine has 1GB RAM). ;)


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Win95 ist wirklich intelligent. Es macht immer das, was du nicht willst.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 20:10   ` Adrian Knoth
@ 2004-08-25 20:19     ` Florian Weimer
  2004-08-25 20:35       ` Adrian Knoth
  0 siblings, 1 reply; 10+ messages in thread
From: Florian Weimer @ 2004-08-25 20:19 UTC (permalink / raw)


* Adrian Knoth:

> And there are other things I didn't know: it's not sufficient to
> include all the static libraries it's also important in which *order*
> you mention them. This order above works, if you move some of
> the libs below (let's say libz) to the beginning of the list the
> linking process fails. Until now I don't know why. Someone else?

Libraries are read in the order specified on the command line, and
object files contained in them are only kept if they contain a
previously undefined symbol, AFAIK.  This means that undefined
references in libraries listed later in the command line cannot be
resolved by object files that have already been skipped.

You should really use libtool's machinery, it deals with all those
corner cases.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 20:19     ` Florian Weimer
@ 2004-08-25 20:35       ` Adrian Knoth
  2004-08-25 20:43         ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Adrian Knoth @ 2004-08-25 20:35 UTC (permalink / raw)


Florian Weimer <fw@deneb.enyo.de> wrote:

> You should really use libtool's machinery, it deals with all those
> corner cases.

Is libtool usable for Ada? I usually don't have to build static
applications, it was just helping a co-student.


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Liebt eure Feinde - vielleicht schadet es ihnen



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 20:35       ` Adrian Knoth
@ 2004-08-25 20:43         ` Florian Weimer
  0 siblings, 0 replies; 10+ messages in thread
From: Florian Weimer @ 2004-08-25 20:43 UTC (permalink / raw)


* Adrian Knoth:

> Florian Weimer <fw@deneb.enyo.de> wrote:
>
>> You should really use libtool's machinery, it deals with all those
>> corner cases.
>
> Is libtool usable for Ada?

I don't think it's usable out of the box, but libtool manages
dependency information that is helpful for static (and dynamic)
linking.  It's simply a good starting point if you want to address
those linking issues.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-25 19:08     ` Ludovic Brenta
@ 2004-08-26 11:15       ` Georg Bauhaus
  2004-08-26 17:57         ` Ludovic Brenta
  0 siblings, 1 reply; 10+ messages in thread
From: Georg Bauhaus @ 2004-08-26 11:15 UTC (permalink / raw)


Ludovic Brenta <ludovic.brenta@insalien.org> wrote:
 
: This was done a few days ago; see bug #258733.  libgtkada2_2.2.1-5
: fixes it, and has been in unstable for 16 days now [1].  There are now
: two -dev packages, libgtkada2-dev and libgnomeada2-dev, and
: libgtkada2-dev has reduced dependencies.  If you are using Sarge, wait
: a couple of days more because libgtkada2_2.2.1-5 is waiting for
: libgnome and gnome-vfs2.

Excellent.

Thanks.
Georg
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: static GtkAda
  2004-08-26 11:15       ` Georg Bauhaus
@ 2004-08-26 17:57         ` Ludovic Brenta
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Brenta @ 2004-08-26 17:57 UTC (permalink / raw)


Georg Bauhaus writes:
> Ludovic Brenta wrote:
>  
> : This was done a few days ago; see bug #258733.  libgtkada2_2.2.1-5
> : fixes it, and has been in unstable for 16 days now [1].  There are now
> : two -dev packages, libgtkada2-dev and libgnomeada2-dev, and
> : libgtkada2-dev has reduced dependencies.  If you are using Sarge, wait
> : a couple of days more because libgtkada2_2.2.1-5 is waiting for
> : libgnome and gnome-vfs2.
>
> Excellent.
>
> Thanks.
> Georg

You're welcome.  BTW, libgtkada2_2.2.1-5 is going into testing today.
You should get it tomorrow or the day after in your Sarge, depending
on which mirror you're using.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-08-26 17:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25 17:22 static GtkAda Adrian Knoth
2004-08-25 17:55 ` Ludovic Brenta
2004-08-25 18:55   ` Georg Bauhaus
2004-08-25 19:08     ` Ludovic Brenta
2004-08-26 11:15       ` Georg Bauhaus
2004-08-26 17:57         ` Ludovic Brenta
2004-08-25 20:10   ` Adrian Knoth
2004-08-25 20:19     ` Florian Weimer
2004-08-25 20:35       ` Adrian Knoth
2004-08-25 20:43         ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox