diff --git a/CMakeLists.txt b/CMakeLists.txt index 2677196da..0f01e7420 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,16 @@ find_package(IBVerbs) find_package(NUMA REQUIRED) find_package(Threads REQUIRED) +set(CMAKE_COLOR_DIAGNOSTICS ON) +function(msg_red text) + string(ASCII 27 ESC) + message("${ESC}[31m${text}${ESC}[0m") +endfunction() + +if(NOT IBVERBS_FOUND) + msg_red("libibverbs not found. Install libibverbs-dev or rdma-core-devel.") +endif() + include(FetchContent) FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz) FetchContent_MakeAvailable(json) diff --git a/src/include/ibverbs_wrapper.hpp b/src/include/ibverbs_wrapper.hpp index c5593344b..0ae9267db 100644 --- a/src/include/ibverbs_wrapper.hpp +++ b/src/include/ibverbs_wrapper.hpp @@ -17,7 +17,18 @@ struct IBVerbs { // Static method to initialize the library static void initialize() { initialized = true; - handle = dlopen("libibverbs.so", RTLD_NOW); + + // Try different versions of libibverbs + const char* lib_possible_names[] = { + "libibverbs.so", + "libibverbs.so.1", + }; + for (int i = 0; lib_possible_names[i] != nullptr; i++) { + handle = dlopen(lib_possible_names[i], RTLD_NOW); + if (handle) { + break; + } + } if (!handle) { throw mscclpp::IbError("Failed to load libibverbs: " + std::string(dlerror()), errno); }