From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,82019ed25537e72d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!fr.ip.ndsoftware.net!newsfeed.wirehub.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: static GtkAda References: From: Ludovic Brenta Date: Wed, 25 Aug 2004 19:55:36 +0200 Message-ID: <87isb7nluv.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:fJ/0ePOKiozARdayaQB8osGuFeM= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 25 Aug 2004 19:56:39 CEST NNTP-Posting-Host: 83.134.239.193 X-Trace: 1093456599 dreader2.news.tiscali.nl 62389 83.134.239.193:60732 X-Complaints-To: abuse@tiscali.nl Xref: g2news1.google.com comp.lang.ada:2993 Date: 2004-08-25T19:56:39+02:00 List-Id: 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.