configure.ac: add -lboost_thread for uhd < 4.2.0

Fix for the following error we see since building master-osmo-trx on
debian 10 instead of 9:
  /usr/bin/ld: ipc_driver_test-uhdwrap.o: undefined reference to symbol '_ZTIN5boost6detail16thread_data_baseE'
  /usr/bin/ld: //usr/lib/x86_64-linux-gnu/libboost_thread.so.1.67.0: error adding symbols: DSO missing from command line

After spending a lot of time on researching this, my understanding is
now that uhd.pc should have had "-lboost_thread" in versions up to the
latest release 4.2.0 because before that it would include boost thread
headers in its logging code:
04a83b6e76

ld is able to figure out which library provides the missing symbol, and
apparently depending on the binutils version and linker flags, it may
just ignore this and not show an error. This is why apparently it worked
with debian 9 and still does work in OBS (different flags), and why it
was not fixed upstream in uhd.pc. By now fixing it is not needed in the
latest version anymore, and there are already versions of uhd.pc in
various linux distributions without -lboost_thread, so I think it's
appropriate to add the workaround here in configure.ac.

Fixes: OS#5608
Related: https://stackoverflow.com/q/19901934
Change-Id: I0367f1c2981bf56252e7514d5993cbbec960b21b
This commit is contained in:
Oliver Smith 2022-07-08 13:24:35 +02:00
parent a39fa875a3
commit 71c46e91df
1 changed files with 8 additions and 0 deletions

View File

@ -185,6 +185,14 @@ AS_IF([test "x$with_uhd" = "xyes"],[
[PKG_CHECK_MODULES(UHD, uhd >= 003.005)]
)]
)
# OS#5608: libuhd < 4.2.0 includes boost/thread/thread.hpp in its logging
# code and therefore requires linking against boost_thread. It's missing in
# uhd.pc, so work around it here.
# https://github.com/EttusResearch/uhd/commit/04a83b6e76beef970854da69ba882d717669b49c
PKG_CHECK_MODULES(UHD, uhd < 004.002,
[LIBS="$LIBS -lboost_thread"],
[]
)
])
AS_IF([test "x$with_singledb" = "xyes"], [