pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
build: probe UHD version with PKG_CHECK_EXISTS

configure.ac appends -lboost_thread for libuhd < 4.2, which needs it
because of a bug in its own code. The probe is a second
PKG_CHECK_MODULES(UHD, uhd < 004.002, ...) reusing the UHD variable
prefix of the first one.

That never asks pkg-config. PKG_CHECK_MODULES expands _PKG_CONFIG,
which opens with

if test -n "$$1"; then
pkg_cv_[]$1="$$1"

so once UHD_CFLAGS and UHD_LIBS are set by the earlier
PKG_CHECK_MODULES(UHD, uhd >= 003.011), the second call takes those
values as its answer, leaves pkg_failed at no, and runs the
action-if-found branch whatever the installed version is.
-lboost_thread is therefore always appended.

On GNU/Linux that only adds a library that is usually present, so the
bug is invisible. On macOS ARM64 with UHD 4.10 from Homebrew there is
no such library on the link path and the build stops:

ld: library 'boost_thread' not found

Use PKG_CHECK_EXISTS, which asks pkg-config and sets no variables. The
workaround then applies where it was meant to, on libuhd < 4.2.

Change-Id: Icbd8af94f258128ea75c0268e0a240dc423ff69e
Signed-off-by: Andrei Gosman <andrei.gosman@gmail.com>
---
M configure.ac
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index a384495..0cd388d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -195,9 +195,8 @@
# 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"],
- []
+ PKG_CHECK_EXISTS([uhd < 004.002],
+ [LIBS="$LIBS -lboost_thread"]
)
])


To view, visit change 43580. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Icbd8af94f258128ea75c0268e0a240dc423ff69e
Gerrit-Change-Number: 43580
Gerrit-PatchSet: 2
Gerrit-Owner: Andrei G <andrei.gosman@gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>