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 645596 - gnome-bluetooth as-needed linking workaround is still needed
gnome-bluetooth as-needed linking workaround is still needed
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: building
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-03-23 17:22 UTC by Nirbheek Chauhan
Modified: 2011-06-20 20:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Artificial dependency to force ld to link libgnome-bluetooth-applet.so into gnome-shell (502 bytes, patch)
2011-03-23 17:22 UTC, Nirbheek Chauhan
none Details | Review
Revert "BluetoothStatus: depend more on libgnome-bluetooth-applet" (1.35 KB, patch)
2011-06-20 19:18 UTC, Dan Winship
reviewed Details | Review
gnome-shell: don't link against libgnome-bluetooth-applet (821 bytes, patch)
2011-06-20 19:18 UTC, Dan Winship
accepted-commit_now Details | Review

Description Nirbheek Chauhan 2011-03-23 17:22:35 UTC
Created attachment 184154 [details] [review]
Artificial dependency to force ld to link libgnome-bluetooth-applet.so into gnome-shell

The patch from bug 639324 to add an artificial dependency on libgnome-bluetooth-applet.so to prevent ld from dropping it with --as-needed is still needed even after the move to a single binary gnome-shell.

b6749f4b: BluetoothStatus: depend more on libgnome-bluetooth-applet

The hack just needs to move from src/gnome-shell-plugin.c to src/main.c

This is needed at least on Gentoo, Arch Linux, and OpenSUSE (although Arch Linux has decided to add /usr/lib/gnome-bluetooth to LD_LIBRARY_PATH so they can make gnome-bluetooth an optional runtime dependency)
Comment 1 Giovanni Campagna 2011-03-23 20:23:53 UTC
(In reply to comment #0)
> Created an attachment (id=184154) [details] [review]
> Artificial dependency to force ld to link libgnome-bluetooth-applet.so into
> gnome-shell
> 
> The patch from bug 639324 to add an artificial dependency on
> libgnome-bluetooth-applet.so to prevent ld from dropping it with --as-needed is
> still needed even after the move to a single binary gnome-shell.
> 
> b6749f4b: BluetoothStatus: depend more on libgnome-bluetooth-applet
> 
> The hack just needs to move from src/gnome-shell-plugin.c to src/main.c
> 
> This is needed at least on Gentoo, Arch Linux, and OpenSUSE (although Arch
> Linux has decided to add /usr/lib/gnome-bluetooth to LD_LIBRARY_PATH so they
> can make gnome-bluetooth an optional runtime dependency)

That patch was merged, and libgnome-shell.so depends on libgnome-bluetooth-applet, so should load it, before any code (JS or C) is run. Moving the HACK should not be needed.
Comment 2 Nirbheek Chauhan 2011-03-23 21:04:33 UTC
(In reply to comment #1)
> That patch was merged, and libgnome-shell.so depends on
> libgnome-bluetooth-applet, so should load it, before any code (JS or C) is run.
> Moving the HACK should not be needed.

That would be true, if the hack were still there. During the move to gnome-shell, the hack was (accidentally?) removed, so it now needs to be re-added. Sorry for not being clear about this.
Comment 3 Owen Taylor 2011-03-26 01:40:47 UTC
History verified, original patch which still applied fine resurrected and re-pushed.
Comment 4 Dan Winship 2011-06-20 19:18:38 UTC
reopening: the code is not needed, and is now creating "can't find libgnome-bluetooth-applet.so" errors in some situations when compiling the typelib.

We were mistakenly still linking the library into gnome-shell even after removing the code that used it. I'm guessing Nirbheek just saw ld giving an error about dropping the unused dependency and then filed this bug. If there is some other problem (eg, GnomeBluetoothApplet not being importable on some platforms), then that would be a girepository bug.
Comment 5 Dan Winship 2011-06-20 19:18:53 UTC
Created attachment 190309 [details] [review]
Revert "BluetoothStatus: depend more on libgnome-bluetooth-applet"

This reverts commit c1ba920c86edb1f1530d031d53985e5b84c294cb.

The depend-on-libgnome-bluetooth-applet code was not removed
accidentally, it was removed intentionally: we call
g_irepository_prepend_search_path() on $(BLUETOOTH_DIR), so we can
just open libgnome-bluetooth-applet.so at runtime just like any other
library.
Comment 6 Dan Winship 2011-06-20 19:18:56 UTC
Created attachment 190310 [details] [review]
gnome-shell: don't link against libgnome-bluetooth-applet

Even after removing the code that *used* libgnome-bluetooth-applet,
we were still accidentally linking against it. Fix that.
Comment 7 Colin Walters 2011-06-20 19:44:47 UTC
Review of attachment 190309 [details] [review]:

Calling g_irepository_prepend_search_path() doesn't add to e.g. LD_LIBRARY_PATH, so the commit message is somewhat misleading.  How about:
s,\.so,.typelib,
s/library/typelib/
Comment 8 Colin Walters 2011-06-20 19:45:25 UTC
Review of attachment 190310 [details] [review]:

Squash with previous commit?
Comment 9 Giovanni Campagna 2011-06-20 20:16:57 UTC
(In reply to comment #7)
> Review of attachment 190309 [details] [review]:
> 
> Calling g_irepository_prepend_search_path() doesn't add to e.g.
> LD_LIBRARY_PATH, so the commit message is somewhat misleading.  How about:
> s,\.so,.typelib,
> s/library/typelib/

Not only it is misleading, it will reintroduce the bug. There is no way to load $(libdir)/gnome-bluetooth/libgnome-bluetooth-applet.so, unless you add that position to LD_LIBRARY_PATH or ld.so.conf.d.
Comment 10 Dan Winship 2011-06-20 20:20:13 UTC
(In reply to comment #7)
> Calling g_irepository_prepend_search_path() doesn't add to e.g.
> LD_LIBRARY_PATH, so the commit message is somewhat misleading.

hm... and also, the patch doesn't work... but apparently you have to debugexit and start the shell again to see it fail; it you just restart, it somehow magically continues to be able to find libgnome-bluetooth-applet.so even though it's not linked against it... that must be why I thought it was safe to remove last time too?

OK, I'm going to close this again and try to figure out what's going wrong with linking on this machine...