aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-12-13 00:06:49 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-12-13 00:30:40 +0300
commit755c5f974beaf1ee7c4651fbf0875abadddbe202 (patch)
tree4cbcbda6fb18be4a974717f58cc011e193f067b9 /contrib
parent03b606454ed532e91be274201826dc870dbcf127 (diff)
downloadydb-755c5f974beaf1ee7c4651fbf0875abadddbe202.tar.gz
Intermediate changes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libs/ibdrv/symbols.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/contrib/libs/ibdrv/symbols.cpp b/contrib/libs/ibdrv/symbols.cpp
index 87bda96e9d..50993cb5cd 100644
--- a/contrib/libs/ibdrv/symbols.cpp
+++ b/contrib/libs/ibdrv/symbols.cpp
@@ -1,17 +1,44 @@
#include "symbols.h"
+#include <util/generic/yexception.h>
+#include <util/generic/vector.h>
#include <util/generic/singleton.h>
#include <util/generic/utility.h>
#include <util/system/dynlib.h>
+#include <util/string/builder.h>
+#include <library/cpp/iterator/zip.h>
#define LOADSYM(name, type) {name = (TId<type>::R*)L->SymOptional(#name);}
const TInfinibandSymbols* IBSym() {
struct TSymbols: TInfinibandSymbols {
TSymbols() {
- L.Reset(new TDynamicLibrary("/usr/lib/libibverbs.so"));
+ auto lib = std::make_unique<TDynamicLibrary>();
- DOVERBS(LOADSYM)
+ TVector<TString> catchedExceptions;
+ TVector<TString> paths = {"/usr/lib/libibverbs.so", "libibverbs.so", "libibverbs.so.1"};
+
+ for (auto path : paths) {
+ try {
+ lib->Open(path.c_str());
+ L.Reset(lib.release());
+ DOVERBS(LOADSYM)
+ return;
+ } catch (std::exception& ex) {
+ catchedExceptions.emplace_back(ex.what());
+ }
+ }
+
+ Y_ABORT_UNLESS(paths.size() == catchedExceptions.size());
+
+ TStringBuilder builder;
+
+ builder << "Cannot open any shared library. Reasons:\n";
+ for (const auto& [reason, path] : Zip(catchedExceptions, paths)) {
+ builder << "Path: " << path << " Reason: " << reason << "\n";
+ }
+
+ ythrow yexception() << builder;
}
THolder<TDynamicLibrary> L;