2006-12-21 19:15:20

by Andrey Rahmatullin

[permalink] [raw]
Subject: [Bluez-devel] [PATCH] 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).

--
WBR, wRAR (ALT Linux Team)


Attachments:
(No filename) (0.00 B)
(No filename) (347.00 B)
(No filename) (164.00 B)
Download all attachments

2006-12-21 19:55:30

by Andrey Rahmatullin

[permalink] [raw]
Subject: Re: [Bluez-devel] [PATCH] bluez-gnome link fix

On Thu, Dec 21, 2006 at 08:37:54PM +0100, Marcel Holtmann wrote:
> 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 .

--
WBR, wRAR (ALT Linux Team)


Attachments:
(No filename) (0.00 B)
(No filename) (347.00 B)
(No filename) (164.00 B)
Download all attachments

2006-12-21 19:37:54

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] [PATCH] bluez-gnome link fix

Hi Andrey,

> 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