Re: static linking



On 5/4/05, riboaz xs4all nl <riboaz xs4all nl> wrote:
> how does one link a gtk+ application (v2.6.2) as a static executable?

You need to build the static gtk libs first. I do:

% cd glib
% ./configure --enable-static
% cd pango
% ./configure --enable-static --with-included-modules=basic-fc
% cd atk
% ./configure --enable-static
% cd gtk+
% ./configure --enable-static --without-libtiff --disable-modules \
              --with-included-loaders=xpm,png

then build your app as usual, but hand-edit the Makefile it generates.
Look for LDADD and chop it about to reference libgthing.a instead of
-lgthing.

It does sort-of work. But internationalisation, themeing, etc. will
not work very well, you'll gets lots of annoying warnings on platforms
which do have gtk+ installed (since your static libs will try to load
any stuff they find in /etc/font.conf or whatever as well as their
included modules), and you'll find you have more dependencies than you
thought you did (do you depend on fontconfig even though you don't
link against it?). All very frustrating.

My best portability experiences are offering ebuilds or .debs and
asking users to make their own.

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]