nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1From 299f2c770ff0abf07b8f394f154168d2aa78aa60 Mon Sep 17 00:00:00 2001
2From: Luna Nova <git@lunnova.dev>
3Date: Sun, 21 Dec 2025 08:23:01 -0800
4Subject: [PATCH] fix(rdc): use pkg-config to find libcap
5
6If libcap isn't available in system wide FHS include paths building would fail.
7Fix this by using pkg-config to find libcap which provides both the library
8to link and include dirs.
9---
10 CMakeLists.txt | 6 +++---
11 rdc_libs/rdc/CMakeLists.txt | 2 +-
12 server/CMakeLists.txt | 2 +-
13 3 files changed, 5 insertions(+), 5 deletions(-)
14
15diff --git a/CMakeLists.txt b/CMakeLists.txt
16index 907c9fbff42..00e0a9dd87d 100755
17--- a/CMakeLists.txt
18+++ b/CMakeLists.txt
19@@ -192,9 +192,9 @@ mark_as_advanced(
20 CPACK_GENERATOR
21 )
22
23-# check if libcap exists
24-# needed for sys/capabilities.h
25-find_library(LIB_CAP NAMES cap REQUIRED)
26+# needed for sys/capability.h
27+find_package(PkgConfig REQUIRED)
28+pkg_check_modules(LIBCAP REQUIRED IMPORTED_TARGET libcap)
29
30 if(BUILD_STANDALONE AND GRPC_ROOT STREQUAL GRPC_ROOT_DEFAULT)
31 message(
32diff --git a/rdc_libs/rdc/CMakeLists.txt b/rdc_libs/rdc/CMakeLists.txt
33index d4e368edca5..f9a3ac4c487 100644
34--- a/rdc_libs/rdc/CMakeLists.txt
35+++ b/rdc_libs/rdc/CMakeLists.txt
36@@ -71,7 +71,7 @@ set(RDC_LIB_INC_LIST
37 message("RDC_LIB_INC_LIST=${RDC_LIB_INC_LIST}")
38
39 add_library(${RDC_LIB} SHARED ${RDC_LIB_SRC_LIST} ${RDC_LIB_INC_LIST})
40-target_link_libraries(${RDC_LIB} ${BOOTSTRAP_LIB} pthread amd_smi cap)
41+target_link_libraries(${RDC_LIB} ${BOOTSTRAP_LIB} pthread amd_smi PkgConfig::LIBCAP)
42 target_include_directories(
43 ${RDC_LIB}
44 PRIVATE "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/include" "${AMD_SMI_INCLUDE_DIR}"
45diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
46index baf0d851c86..0a6e71dda1c 100755
47--- a/server/CMakeLists.txt
48+++ b/server/CMakeLists.txt
49@@ -97,7 +97,7 @@ target_link_libraries(
50 pthread
51 rt
52 gRPC::grpc++
53- cap
54+ PkgConfig::LIBCAP
55 dl
56 amd_smi
57 rdc_bootstrap