Skip to content

find/print_utility() error on official ubuntu packages #43

@guruofquality

Description

@guruofquality

The official ubuntu packages use PKG_LIB_DIR="/usr/lib/uhd" to install the examples and utils.

override_dh_auto_configure:
    dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPKG_LIB_DIR="/usr/lib/uhd"

The problem is that the uhd::find_utility() call uses the UHD_LIB_DIR regardless, so the prints end up being incorrect. This is a small patch to use PKG_LIB_DIR in find_utility:

diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt
index 369920a..7940350 100644
--- a/host/lib/utils/CMakeLists.txt
+++ b/host/lib/utils/CMakeLists.txt
@@ -123,7 +123,7 @@ SET_SOURCE_FILES_PROPERTIES(
     ${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/images.cpp
     PROPERTIES COMPILE_DEFINITIONS
-    "UHD_PKG_PATH=\"${UHD_PKG_PATH}\";UHD_LIB_DIR=\"lib${LIB_SUFFIX}\""
+    "UHD_PKG_PATH=\"${UHD_PKG_PATH}\";UHD_LIB_DIR=\"lib${LIB_SUFFIX}\";PKG_LIB_DIR=\"${PKG_LIB_DIR}\""
 )

 ########################################################################
diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp
index f29318d..ac30d9b 100644
--- a/host/lib/utils/paths.cpp
+++ b/host/lib/utils/paths.cpp
@@ -363,7 +363,7 @@ std::string uhd::find_image_path(const std::string &image_name, const std::strin
 }

 std::string uhd::find_utility(std::string name) {
-    return fs::path(fs::path(uhd::get_pkg_path()) / UHD_LIB_DIR / "uhd" / "utils" / name)
+    return fs::path(fs::path(uhd::get_pkg_path()) / PKG_LIB_DIR / "utils" / name)
         .string();
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions