From 71c46e91df1ffc054f3dd791e3703c7885aa3186 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 8 Jul 2022 13:24:35 +0200 Subject: [PATCH] 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: https://github.com/EttusResearch/uhd/commit/04a83b6e76beef970854da69ba882d717669b49c 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 --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 422ad656..37444a57 100644 --- a/configure.ac +++ b/configure.ac @@ -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"], [