Skip to content

Commit cdb080e

Browse files
authored
Merge branch 'main' into chhwang/fix-no-ib
2 parents c5b9b44 + 2b987cf commit cdb080e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ endif()
154154
find_package(NUMA REQUIRED)
155155
find_package(Threads REQUIRED)
156156

157+
set(CMAKE_COLOR_DIAGNOSTICS ON)
158+
function(msg_red text)
159+
string(ASCII 27 ESC)
160+
message("${ESC}[31m${text}${ESC}[0m")
161+
endfunction()
162+
163+
if(NOT IBVERBS_FOUND)
164+
msg_red("libibverbs not found. Install libibverbs-dev or rdma-core-devel.")
165+
endif()
166+
157167
include(FetchContent)
158168
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
159169
FetchContent_MakeAvailable(json)

src/include/ibverbs_wrapper.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ struct IBVerbs {
1717
// Static method to initialize the library
1818
static void initialize() {
1919
initialized = true;
20-
handle = dlopen("libibverbs.so", RTLD_NOW);
20+
21+
// Try different versions of libibverbs
22+
const char* lib_possible_names[] = {
23+
"libibverbs.so",
24+
"libibverbs.so.1",
25+
};
26+
for (int i = 0; lib_possible_names[i] != nullptr; i++) {
27+
handle = dlopen(lib_possible_names[i], RTLD_NOW);
28+
if (handle) {
29+
break;
30+
}
31+
}
2132
if (!handle) {
2233
throw mscclpp::IbError("Failed to load libibverbs: " + std::string(dlerror()), errno);
2334
}

0 commit comments

Comments
 (0)