summaryrefslogtreecommitdiff
path: root/pkgs/development/rocm-modules/rdc/fix-libcap-pkgconfig.patch
blob: 54e7303ce88f323e8407ded7d93216c1b37efe53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 299f2c770ff0abf07b8f394f154168d2aa78aa60 Mon Sep 17 00:00:00 2001
From: Luna Nova <git@lunnova.dev>
Date: Sun, 21 Dec 2025 08:23:01 -0800
Subject: [PATCH] fix(rdc): use pkg-config to find libcap

If libcap isn't available in system wide FHS include paths building would fail.
Fix this by using pkg-config to find libcap which provides both the library
to link and include dirs.
---
 CMakeLists.txt              | 6 +++---
 rdc_libs/rdc/CMakeLists.txt | 2 +-
 server/CMakeLists.txt       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 907c9fbff42..00e0a9dd87d 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,9 +192,9 @@ mark_as_advanced(
     CPACK_GENERATOR
 )
 
-# check if libcap exists
-# needed for sys/capabilities.h
-find_library(LIB_CAP NAMES cap REQUIRED)
+# needed for sys/capability.h
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(LIBCAP REQUIRED IMPORTED_TARGET libcap)
 
 if(BUILD_STANDALONE AND GRPC_ROOT STREQUAL GRPC_ROOT_DEFAULT)
     message(
diff --git a/rdc_libs/rdc/CMakeLists.txt b/rdc_libs/rdc/CMakeLists.txt
index d4e368edca5..f9a3ac4c487 100644
--- a/rdc_libs/rdc/CMakeLists.txt
+++ b/rdc_libs/rdc/CMakeLists.txt
@@ -71,7 +71,7 @@ set(RDC_LIB_INC_LIST
 message("RDC_LIB_INC_LIST=${RDC_LIB_INC_LIST}")
 
 add_library(${RDC_LIB} SHARED ${RDC_LIB_SRC_LIST} ${RDC_LIB_INC_LIST})
-target_link_libraries(${RDC_LIB} ${BOOTSTRAP_LIB} pthread amd_smi cap)
+target_link_libraries(${RDC_LIB} ${BOOTSTRAP_LIB} pthread amd_smi PkgConfig::LIBCAP)
 target_include_directories(
     ${RDC_LIB}
     PRIVATE "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/include" "${AMD_SMI_INCLUDE_DIR}"
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index baf0d851c86..0a6e71dda1c 100755
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -97,7 +97,7 @@ target_link_libraries(
     pthread
     rt
     gRPC::grpc++
-    cap
+    PkgConfig::LIBCAP
     dl
     amd_smi
     rdc_bootstrap