Bug 30791

Summary: doesn't build if LD_LIBRARY_PATH contains an older version
Product: Telepathy Reporter: william.jon.mccann
Component: tp-docAssignee: Danielle Madeley <danielle>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: danielle
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/danni/telepathy-glib.git;a=shortlog;h=refs/heads/doc-build-30791
Whiteboard: review+ with further testing
i915 platform: i915 features:

Description william.jon.mccann 2010-10-12 00:07:41 UTC
/home/mccann/devel/gnome/telepathy-glib-0.13.1/docs/reference/.libs/lt-telepathy-glib-scan: /opt/gnome/lib/libtelepathy-glib.so.0: version `TELEPATHY_GLIB_0.13.1' not found (required by /home/mccann/devel/gnome/telepathy-glib-0.13.1/docs/reference/.libs/lt-telepathy-glib-scan)
Comment 1 Jonny Lamb 2010-10-12 01:14:14 UTC
You filed this against tp-doc but do you in fact mean tp-glib?
Comment 2 william.jon.mccann 2010-10-12 01:15:51 UTC
oh I just clicked the link on the telepathy-glib web page.  Didn't notice you have all the telepathy stuff in one product, sorry.
Comment 3 Jonny Lamb 2010-10-12 01:26:49 UTC
(In reply to comment #2)
> oh I just clicked the link on the telepathy-glib web page.  Didn't notice you
> have all the telepathy stuff in one product, sorry.

Ah interesting, looks like I should get that fixed. Where is this link please?
Comment 4 Simon McVittie 2010-10-12 03:27:50 UTC
(In reply to comment #0)
> /home/mccann/devel/gnome/telepathy-glib-0.13.1/docs/reference/.libs/lt-telepathy-glib-scan:
> /opt/gnome/lib/libtelepathy-glib.so.0: version `TELEPATHY_GLIB_0.13.1' not
> found (required by
> /home/mccann/devel/gnome/telepathy-glib-0.13.1/docs/reference/.libs/lt-telepathy-glib-scan)

telepathy-glib-scan is meant to link against the just-compiled version of telepathy-glib, but it looks as though it's picking up your installed copy instead.

Do you have an LD_LIBRARY_PATH environment variable set? If so, what?

If you look in docs/reference/Makefile (the generated file, not the source file), what are your GTKDOC_LIBS and LDFLAGS set to?

When telepathy-glib-scan is linked (it should be a few lines above the error message you pasted), what is the exact command?

You may be able to get more information from the output of:

rm -f docs/reference/*.stamp

make -n -C docs/reference V=1

make -C docs/reference V=1
Comment 5 Danielle Madeley 2010-10-13 18:21:54 UTC
I can reproduce this.

With a system telepathy-glib 0.12:
 * rm libtelepathy-glib.* from build prefix
[danni@adelie telepathy-glib]$ echo ~$LD_LIBRARY_PATH~
~~
 * ./autogen.sh --enable-gtk-doc --prefix=...
 * make clean
 * make -j2

Works

[danni@adelie telepathy-glib]$ export LD_LIBRARY_PATH=~/src/install/lib
 * make -C docs clean
 * make -j2

Works

 * Install telepathy-glib 0.12.0 (from tarball) into build prefix
[danni@adelie telepathy-glib-0.12.0]$ ls ~/src/install/lib/libtelepathy-glib.*
/home/danni/src/install/lib/libtelepathy-glib.la
/home/danni/src/install/lib/libtelepathy-glib.so
/home/danni/src/install/lib/libtelepathy-glib.so.0
/home/danni/src/install/lib/libtelepathy-glib.so.0.45.0
[danni@adelie telepathy-glib]$ unset LD_LIBRARY_PATH
[danni@adelie telepathy-glib]$ echo ~$LD_LIBRARY_PATH~
~~
 * make -C docs clean
 * make V=1

make[3]: Entering directory `/home/danni/src/GIT/telepathy/telepathy-glib/docs/reference'
gtk-doc: Scanning header files
gtk-doc: Compiling scanner
libtool: compile:  gcc -std=gnu99 -I../.. -I../.. -pthread -I/home/danni/src/install/include/glib-2.0 -I/home/danni/src/install/lib/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread -I/home/danni/src/install/include/glib-2.0 -I/home/danni/src/install/lib/glib-2.0/include -pthread -I/home/danni/src/install/include/gio-unix-2.0/ -I/home/danni/src/install/include/glib-2.0 -I/home/danni/src/install/lib/glib-2.0/include -ggdb -O0 -ggdb -O0 -c telepathy-glib-scan.c  -fPIC -DPIC -o .libs/telepathy-glib-scan.o
libtool: compile:  gcc -std=gnu99 -I../.. -I../.. -pthread -I/home/danni/src/install/include/glib-2.0 -I/home/danni/src/install/lib/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread -I/home/danni/src/install/include/glib-2.0 -I/home/danni/src/install/lib/glib-2.0/include -pthread -I/home/danni/src/install/include/gio-unix-2.0/ -I/home/danni/src/install/include/glib-2.0 -I/home/danni/src/install/lib/glib-2.0/include -ggdb -O0 -ggdb -O0 -c telepathy-glib-scan.c -o telepathy-glib-scan.o >/dev/null 2>&1
gtk-doc: Linking scanner
libtool: link: gcc -std=gnu99 -ggdb -O0 -Wl,-O1 .libs/telepathy-glib-scan.o -pthread -pthread -pthread -Wl,-O1 -o .libs/telepathy-glib-scan  -L/home/danni/src/install/lib -L/lib -ldbus-glib-1 -ldbus-1 -lpthread /home/danni/src/install/lib/libgio-2.0.so /home/danni/src/install/lib/libgobject-2.0.so /home/danni/src/install/lib/libgmodule-2.0.so /home/danni/src/install/lib/libgthread-2.0.so -lrt /home/danni/src/install/lib/libglib-2.0.so ../../telepathy-glib/.libs/libtelepathy-glib.so -pthread  -Wl,-rpath -Wl,/home/danni/src/install/lib
gtk-doc: Running scanner telepathy-glib-scan
/home/danni/src/GIT/telepathy/telepathy-glib/docs/reference/.libs/lt-telepathy-glib-scan: /home/danni/src/install/lib/libtelepathy-glib.so.0: version `TELEPATHY_GLIB_0.13.1' not found (required by /home/danni/src/GIT/telepathy/telepathy-glib/docs/reference/.libs/lt-telepathy-glib-scan)
/home/danni/src/GIT/telepathy/telepathy-glib/docs/reference/.libs/lt-telepathy-glib-scan: /home/danni/src/install/lib/libtelepathy-glib.so.0: version `TELEPATHY_GLIB_0.13.1.1_UNRELEASED' not found (required by /home/danni/src/GIT/telepathy/telepathy-glib/docs/reference/.libs/lt-telepathy-glib-scan)
/home/danni/src/GIT/telepathy/telepathy-glib/docs/reference/.libs/lt-telepathy-glib-scan: /home/danni/src/install/lib/libtelepathy-glib.so.0: version `TELEPATHY_GLIB_0.13.0' not found (required by /home/danni/src/GIT/telepathy/telepathy-glib/docs/reference/.libs/lt-telepathy-glib-scan)
Scan failed:
Comment 6 Danielle Madeley 2010-10-13 21:15:49 UTC
http://git.collabora.co.uk/?p=user/danni/telepathy-glib.git;a=shortlog;h=refs/heads/doc-build-30791

Swapping the order of GTKDOC_LIBS so that libtp-glib is first fixes this problem.
Comment 7 Will Thompson 2010-10-14 02:15:31 UTC
Will this break Fedora? IIRC they have a fascist linker that requires a particular ordering of libraries.
Comment 8 Simon McVittie 2010-10-14 03:20:57 UTC
You can make Debian/Ubuntu emulate Fedora's linker by configuring with "./configure [...] LDFLAGS=-Wl,--no-add-needed" (they just changed a default).

The strict ordering requirement comes from platforms with only static libraries or with a rubbish dynamic linker, but libtool is meant to take care of that for us, and I don't think anyone actually uses Telepathy on AIX anyway.

The order we normally use is stolen from gstreamer, <http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/random/moving-plugins#n72>:

> - should list libs and cflags in stack order, with lowest in the stack first
>     (so one can link against highest in the stack somewhere else without
>      picking up everything from the somewhere else)

For CFLAGS we've had to adjust that to "things from the same source tree are first, then external things with the lowest in the stack first". I think we might have to do the same with LDFLAGS.

Danni, your patch looks fine, if a clean build with LDFLAGS=-Wl,--no-add-needed works. If you test with that and it works, feel free to merge; I might cherry-pick it myself if I get there first.
Comment 9 Danielle Madeley 2010-10-14 04:02:20 UTC
Tested. Works. Merged.

@smcv: It's not just LD_LIBRARY_PATH (my LD_LIBRARY_PATH was empty), it's the whole library search order.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.