libwt requires an explicit link to libboost_signals

Bug #900354 reported by Uqbar
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
witty (Ubuntu)
Invalid
Undecided
Pau Garcia Quiles

Bug Description

If you don't link the objects against libboost_signals, you'll get unresolved symbols.
Same sourcecode was working fine without up to Natty.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: libwt-dev 3.1.10-1build0.1
ProcVersionSignature: Ubuntu 3.0.0-12.19~ppa1-generic-pae-ck 3.0.4-ck1
Uname: Linux 3.0.0-12-generic-pae-ck i686
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Mon Dec 5 17:07:27 2011
InstallationMedia: Kubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
ProcEnviron:
 LANGUAGE=
 LC_COLLATE=C
 PATH=(custom, user)
 LANG=it_IT.UTF-8
 SHELL=/bin/bash
SourcePackage: witty
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Uqbar (uqbar) wrote :
Revision history for this message
Pau Garcia Quiles (pgquiles) wrote :

How is this a bug in Wt? It looks more like a bug in your application's build system :-? You should never count on a shared library providing third-party symbols.

Revision history for this message
Uqbar (uqbar) wrote :

My build system is a command line in a fresh installed Ubuntu.
Something like:
g++ -o application file1.c++ file2.c++ -lwt -lwthttp

Revision history for this message
Pau Garcia Quiles (pgquiles) wrote :

Your command line is missing a few -lboost_blahblah

Revision history for this message
Pau Garcia Quiles (pgquiles) wrote :

Reporter wrongly assumed Wt libraries would transitively provide third-party symbols.

Changed in witty (Ubuntu):
assignee: nobody → Pau Garcia i Quiles (pgquiles)
status: New → Invalid
Revision history for this message
Boris (starius) wrote :

Hello!

This is actually a problem of Wt, not of code using Wt.

See test case. It does not use boost.signals directly.

I can compile this test on Ubuntu Natty and Debian Squeeze:

 g++ -lwt -lwthttp 900354.cpp -o 900354

Errors on Ubuntu Lucid (e.g., undefined reference to `boost::signals::detail::slot_base::create_connection()')

Errors on Debian Squeeze with manually built Wt 3.2.0. (undefined reference to symbol 'boost::signals::trackable::~trackable())

I'm suspecting fresh Ubuntu Oneiric to fail. Can anyone test this?

3.2.1-1~natty~pgquiles1: no errors

Natty with ppa https://launchpad.net/~pgquiles/+archive/wt/+build/2618285
no errors

Maybe, it is a bug of some Wt version, not of Debian or Ubuntu packages.

Revision history for this message
Pau Garcia Quiles (pgquiles) wrote :

#6

g++ -lwt -lwthttp 900354.cpp -o 900354

is wrong

-l goes at the end:

g++ 900354.cpp -o 900354 -lwt -lwthttp

Please try that and tell me if you still have the problem.

Also, please add the output of:

$ objdump -x /usr/lib/libwt.so
$ objdump -x /usr/lib/libwthttp.so

No need to add everything, I'm only interested in the DT_NEEDED sections, i. e. the first 30 or so lines.

Revision history for this message
Boris (starius) wrote :
Download full text (4.6 KiB)

(only for Debian Squeeze with manually built Wt 3.2.1, Ubuntu Lucid will be latter)

I have tried "g++ 900354.cpp -o 900354 -lwt -lwthttp" -- the same result:

/usr/bin/ld: /tmp/ccB6Voar.o: undefined reference to symbol 'boost::signals::trackable::~trackable()'
/usr/bin/ld: note: 'boost::signals::trackable::~trackable()' is defined in DSO /usr/lib/libboost_signals.so.1.42.0 so try adding it to the linker command line
/usr/lib/libboost_signals.so.1.42.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

objdump -x /usr/lib/libwt.so
 NEEDED libboost_thread.so.1.42.0
 NEEDED libboost_regex.so.1.42.0
 NEEDED libboost_signals.so.1.42.0
 NEEDED libboost_system.so.1.42.0
 NEEDED libboost_date_time.so.1.42.0
 NEEDED libssl.so.0.9.8
 NEEDED libcrypto.so.0.9.8
 NEEDED libGraphicsMagick.so.3
 NEEDED libpangoft2-1.0.so.0
 NEEDED libpango-1.0.so.0
 NEEDED libgobject-2.0.so.0
 NEEDED libglib-2.0.so.0
 NEEDED libpthread.so.0
 NEEDED libstdc++.so.6
 NEEDED libm.so.6
 NEEDED libgcc_s.so.1
 NEEDED libc.so.6

objdump -x /usr/lib/libwthttp.so
  NEEDED libwt.so.31
  NEEDED libz.so.1
  NEEDED libssl.so.0.9.8
  NEEDED libcrypto.so.0.9.8
  NEEDED libboost_thread.so.1.42.0
  NEEDED libboost_filesystem.so.1.42.0
  NEEDED libboost_program_options.so.1.42.0
  NEEDED libboost_date_time.so.1.42.0
  NEEDED libpthread.so.0
  NEEDED libboost_regex.so.1.42.0
  NEEDED libboost_signals.so.1.42.0
  NEEDED libboost_system.so.1.42.0
  NEEDED libGraphicsMagick.so.3
  NEEDED libpangoft2-1.0.so.0
  NEEDED libpango-1.0.so.0
  NEEDED libgobject-2.0.so.0
  NEEDED libglib-2.0.so.0
  NEEDED libstdc++.so.6 ...

Read more...

Revision history for this message
Pau Garcia Quiles (pgquiles) wrote :

This is an upstream problem. They are not setting a reduced link interface:

http://techbase.kde.org/Development/CMake_KDE_4_2#New:_The_reduced_link_interface

http://cmake.org/cmake/help/v2.8.8/cmake.html#command:target_link_libraries

I'll talk to upstream and we may work on it this summer but it's definitely not a bug in the packaging.

BTW, 3.2.1 is available from the Wt PPA, as usual:

http://launchpad.net/~pgquiles/+archive/wt/

Revision history for this message
Pau Garcia Quiles (pgquiles) wrote : Reduced link interface

Hi,

A while ago a bug was reported in Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/witty/+bug/900354

It boils down to this: building an application which uses Wt requires
linking to some libraries (Boost Signals, etc), even if the
application does not directly use them. That can be solved by
establishing a so-called "link interface" for libwt, libwthttp, etc.
It's documented here:

http://techbase.kde.org/Development/CMake_KDE_4_2#New:_The_reduced_link_interface
http://cmake.org/cmake/help/v2.8.8/cmake.html#command:target_link_libraries

I cannot work on this on my (nonexistent) spare time[*] at the moment,
just mentioning the problem and the solution in case other people are
affected.

[*] But of course if someone is interested in sponsoring, do not
hesitate to contact me

--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

Revision history for this message
Boris (starius) wrote :

On Ubuntu Oneiric (fresh install with Universe repo enabled):

/usr/bin/ld: /tmp/ccDHQ6ub.o: undefined reference to symbol 'boost::signals::trackable::~trackable()'
/usr/bin/ld: note: 'boost::signals::trackable::~trackable()' is defined in DSO /usr/lib/libboost_signals.so.1.46.1 so try adding it to the linker command line
/usr/lib/libboost_signals.so.1.46.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

objdump -x /usr/lib/libwt.so
  NEEDED libboost_thread.so.1.46.1
  NEEDED libboost_regex.so.1.46.1
  NEEDED libboost_signals.so.1.46.1
  NEEDED libboost_system.so.1.46.1
  NEEDED libboost_date_time.so.1.46.1
  NEEDED libboost_filesystem.so.1.46.1
  NEEDED libhpdf-2.1.0.so
  NEEDED libGraphicsMagick.so.3
  NEEDED libpthread.so.0
  NEEDED libstdc++.so.6
  NEEDED libm.so.6
  NEEDED libgcc_s.so.1
  NEEDED libc.so.6

objdump -x /usr/lib/libwthttp.so
  NEEDED libwt.so.29
  NEEDED libz.so.1
  NEEDED libssl.so.1.0.0
  NEEDED libcrypto.so.1.0.0
  NEEDED libboost_thread.so.1.46.1
  NEEDED libboost_filesystem.so.1.46.1
  NEEDED libboost_program_options.so.1.46.1
  NEEDED libpthread.so.0
  NEEDED libboost_system.so.1.46.1
  NEEDED libstdc++.so.6
  NEEDED libgcc_s.so.1
  NEEDED libc.so.6

Revision history for this message
Boris (starius) wrote :

Errors on Ubuntu Lucid turned out to be nonreproducible.
So the only affected Ubuntu version is Oneiric

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.