From 3e73a7a924937fc6cae409b36da3a60a555cd1a1 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Wed, 20 Jun 2018 16:00:00 +0800 Subject: [PATCH] add usr local lib to dynamic search path --- paddle/fluid/platform/dynload/dynamic_loader.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle/fluid/platform/dynload/dynamic_loader.cc b/paddle/fluid/platform/dynload/dynamic_loader.cc index 34fbccddc2b..7b0adf25ac0 100644 --- a/paddle/fluid/platform/dynload/dynamic_loader.cc +++ b/paddle/fluid/platform/dynload/dynamic_loader.cc @@ -78,7 +78,12 @@ static inline void* GetDsoHandleFromDefaultPath(const std::string& dso_path, VLOG(3) << "Try to find library: " << dso_path << " from default system path."; // default search from LD_LIBRARY_PATH/DYLD_LIBRARY_PATH + // and /usr/local/lib path void* dso_handle = dlopen(dso_path.c_str(), dynload_flags); + if (nullptr == dso_handle) { + dso_handle = + dlopen(join("/usr/local/lib/", dso_path).c_str(), dynload_flags); + } // DYLD_LIBRARY_PATH is disabled after Mac OS 10.11 to // bring System Integrity Projection (SIP), if dso_handle @@ -99,6 +104,10 @@ static inline void* GetDsoHandleFromDefaultPath(const std::string& dso_path, } #endif + if (nullptr == dso_handle) { + LOG(WARNING) << "Can not find library: " << dso_path + << ". Please try to set add the lib path to LD_LIBRARY_PATH."; + } return dso_handle; } -- GitLab