After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 405352 - problem with building static libraries
problem with building static libraries
Status: RESOLVED INVALID
Product: general
Classification: Other
Component: general
unspecified
Other All
: Normal minor
: ---
Assigned To: Unknown User
Unknown User
Depends on:
Blocks:
 
 
Reported: 2007-02-07 13:28 UTC by Stanislav Brabec
Modified: 2018-08-22 19:23 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16



Description Stanislav Brabec 2007-02-07 13:28:49 UTC
Please describe the problem:
Most GNOME libraries are provided as static libraries, too. But trying to link anything for real shows, that there are too many bugs making it impossible.

I am reporting it against libgnome, but much more platform libraries is affected.

Steps to reproduce:
1. gcc -Wall gnome-hello.c -o gnome-hello -static $(pkg-config libgnomeui-2.0 --static --libs ; pkg-config libgnomeui-2.0 --cflags)
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: cannot find -lgnome-keyring
collect2: ld returned 1 exit status

gnome-keyring is configured to not provide static library, but libgnomeui ignores it.

2. OK. Edit gnome-keyring, gtk, glib and atk to provide static libraries. Edit manually pkg-config output and try again.
See https://bugzilla.novell.com/show_bug.cgi?id=238552#c12 for details

You can see really long list of missing symbols, which implies a really long list missing in Libs.private somewhere (libgnome or lower library) - esd, audiofile, dbus-1.

3. The same is broken for gtk, too:
gcc -Wall gtk-hello.c -o gtk-hello -static $(pkg-config gtk+-2.0 --static --libs ; pkg-config gtk+-2.0 --cflags)
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: cannot find -lgtk-x11-2.0
collect2: ld returned 1 exit status

Actual results:


Expected results:


Does this happen every time?


Other information:
This bug can be fixed in two ways:

Either:

- Add AM_DISABLE_STATIC in configure.in/ac of all platform packages.

Or:

- Provide working static library infrastructure (i. e. fix all .pc files, provide static libraries for all related platform packages). This solution additionally needs to find all fragile places in GNOME (pango module loading, gtk module loading, gnome-vfs module loading,...) and properly disable static linking there, because static linking would cause more strict dependency on modules than dynamic one.
Comment 1 Christian Persch 2007-02-07 14:11:58 UTC
From the downstream bug report:

> In this case, it's a bug in libgnome-2.0.pc. It misses a line like this:
> Libs.private: -lesd

Actually I think it's missing "esound" from Requires.private instead; that should certainly be fixed.

---

Is there anything else in this bug report about libgnome? If you want to propose getting rid of static libs everwhere, please discuss this on an appropriate mailing list (probably desktop-devel-list@gnome.org) instead.
Comment 2 Stanislav Brabec 2007-02-07 17:17:44 UTC
Yes.

At least these private libraries are missing somewhere (in braces the most probable candidate):

libesd (libgnome), libaudiofile (libgnome), libXrender (cairo), libxml2 (libfontconfig), libXau (libX11), libXdmcp (libbonobo), libORBitCosNaming-2 (libbonobo), libdbus-1 (libgnome-vfs-2, maybe also libdbus-glib-1).

Then you need to properly define -Wl,-Bstatic and -Wl,-Bdynamic to static pkgconfig linking options to all references to libraries from packages: atk, gtk+, glib, gnome-keyring, pango (these packages use AM_DISABLE_STATIC, so they do not provide static libraries).

As an alternative, you can re-enable building of static instances of atk, gtk+, glib, gnome-keyring, pango and find a proper fix for fragility of loading of gtk modules, pango modules and gmodule stuff.

And finally you have to solve fragility of loading:


- gnome-vfs modules from statically linked binaries (probably by disabling of static linking of gnome-vfs). Following optional private libraries may be needed for static libgnomevfs-2: libdns_sd or libavahi, libssl or libgnutls.

- GConf backends from statically linked binaries (probably by disabling of static linking of GConf).

Comment 3 Stanislav Brabec 2007-02-07 18:14:00 UTC
Discussion about removing of static libraries on desktop-devel-list@gnome.org:

http://mail.gnome.org/archives/desktop-devel-list/2007-February/msg00120.html
Comment 4 Stanislav Brabec 2007-02-08 15:09:52 UTC
Further analysis shows, that even after all mentioned fixes, pkg-config cannot provide correct linker options, if any of libraries in chain is shared only.

It is a case of libgnome (gtk+-2.0 and pango are is shared-only by default for good reason).

Reported as pkg-config bug:
https://bugs.freedesktop.org/show_bug.cgi?id=9917
Comment 5 Kjartan Maraas 2007-02-08 22:55:03 UTC
Please file individual bugs for all modules that have problems like this to make sure they're looked at by the maintainers of said modules.
Comment 6 Kjartan Maraas 2007-04-09 11:37:27 UTC
I fixed libgnome. Moving this to product "general".
Comment 7 André Klapper 2018-08-22 19:23:10 UTC
(In reply to Kjartan Maraas from comment #5)
> Please file individual bugs for all modules that have problems like this to
> make sure they're looked at by the maintainers of said modules.

This. ^ :) Thanks!