Skip to contentSkip to conversation

bluez-gnome link fix

PATCH In review Andrey Rahmatullin 3 participants 3 messages Dec 21, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bluez-gnome link fix

Hi.

There is a small patch which fixes linking of bluetooth-sendto with --as-needed linker option (libs should be in command line only after sources and static libs that use them).

Signature · 1 line
WBR, wRAR (ALT Linux Team)
sendto/Makefile.am renamed from sendto/Makefile.am.orig +1 -1
@@ -3,7 +3,7 @@
 
 bluetooth_sendto_SOURCES = main.c
 
-bluetooth_sendto_LDADD = @GTK_LIBS@ @DBUS_LIBS@ $(top_builddir)/common/libcommon.a
+bluetooth_sendto_LDADD = @GTK_LIBS@ $(top_builddir)/common/libcommon.a @DBUS_LIBS@
 
 AM_CFLAGS = @DBUS_CFLAGS@ @GTK_CFLAGS@
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Andrey,

Quoted 3 lines

There is a small patch which fixes linking of bluetooth-sendto with --as-needed linker option (libs should be in command line only after sources and static libs that use them).

I need a more detailed explanation on why your fix is correct, because I simply don't see it.

Regards

Marcel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw
Quoted 2 lines · Marcel Holtmann

I need a more detailed explanation on why your fix is correct, because I simply don't see it.

gcc -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -DDBUS_API_SUBJECT_TO_CHANGE
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -pipe -Wall -O2 -march=athlon -mtune=athlon-xp
-D_FORTIFY_SOURCE=2 -o bluetooth-sendto main.o -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -ldbus-glib-1 -ldbus-1 -lglib-2.0
../common/libcommon.a

../common/libcommon.a(manager.o): In function `update_adapter_list':
manager.c:(.text+0x26a): undefined reference to dbus_g_proxy_call' ../common/libcommon.a(manager.o): In function bluetooth_manager_init':
manager.c:(.text+0x306): undefined reference to dbus_g_proxy_new_for_name' manager.c:(.text+0x332): undefined reference to dbus_g_proxy_add_signal' manager.c:(.text+0x356): undefined reference to dbus_g_proxy_connect_signal' manager.c:(.text+0x376): undefined reference to dbus_g_proxy_add_signal' manager.c:(.text+0x39a): undefined reference to dbus_g_proxy_connect_signal' ../common/libcommon.a(private.o): In function bluetooth_get_connection':
private.c:(.text+0x2c): undefined reference to `dbus_g_bus_get'
collect2: ld returned 1 exit status
make[2]: *** [bluetooth-sendto] Error 1

If you use ld --as-needed (which is by default in some distributions), you should write all -l options after, not before .o files (and .a file is just a collection of .o) which use symbols from that -l libs, or they will be ignored.

Note also that if -lfoo resolves to static lib, this behavior will be always the same even without --as-needed.

Normally if you use autotools, all that you need to do is writing your -lfoo to LDADD/LIBADD, not LDFLAGS. But if you link internal static libs to your binaries, you still need to check the order of -l and .a .

Signature · 1 line
WBR, wRAR (ALT Linux Team)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel