diff --git a/src/eckit/system/LibraryManager.cc b/src/eckit/system/LibraryManager.cc index 66ed4a54e..0c831be94 100644 --- a/src/eckit/system/LibraryManager.cc +++ b/src/eckit/system/LibraryManager.cc @@ -201,47 +201,55 @@ class LibraryRegistry { } // now we try with the system LD_LIBRARY_PATH environment variable - Log::debug() << "Loading library " << dynamicLibraryName << " from LD_LIBRARY_PATH or system paths" - << std::endl; + Log::warning() << "Loading library " << dynamicLibraryName << " from LD_LIBRARY_PATH or system paths" + << "LD_LIBRARY_PATH=" << ::getenv("LD_LIBRARY_PATH") + << std::endl; void* plib = ::dlopen(dynamicLibraryName.c_str(), RTLD_NOW | RTLD_GLOBAL); if (plib) { Log::debug() << "Loaded library " << path_from_libhandle(dynamicLibraryName, plib) << std::endl; return plib; } + Log::warning() << "Failed to load library " << dynamicLibraryName + << "dlerror: " << ::dlerror() + << std::endl; - Log::warning() << "Failed to load library " << dynamicLibraryName << std::endl; - return nullptr; + return nullptr; // <-- this is awful, upstream function will throw with the wrong error message as a result } Plugin* lookupPlugin(const std::string& name) const { + std::cout << "XXX: lookupPlugin " << name << std::endl; auto it = plugins_.find(name); if (it != plugins_.end()) { std::string libname = it->second; + std::cout << "XXX: lookupPlugin: plugin found: name=" << name << " and libname=" << libname << std::endl; return dynamic_cast(&lookup(libname)); } + std::cout << "XXX: lookupPlugin: plugin not found :(" << std::endl; return nullptr; } Plugin& loadPlugin(const std::string& name, const std::string& libname = std::string()) { - + std::cout << "XXX: loadPlugin " << name << " " << libname << std::endl; AutoLock lockme(mutex_); std::string lib = libname.empty() ? name : libname; // check if respective library is already loaded if (!exists(lib)) { + std::cout << "XXX: loadPlugin: lib not yet loaded (loading now) lib= " << lib << std::endl; // lets load since the associated library isn't registered void* libhandle = loadDynamicLibrary(lib); // the plugin should self-register when the library loads - Plugin* plugin = lookupPlugin(name); + Plugin* plugin = lookupPlugin(name); if (plugin) { Log::debug() << "Loaded plugin [" << name << "] from library [" << lib << "]" << std::endl; plugin->handle(libhandle); initPlugin(plugin); return *plugin; } + std::cout << "XXX: plugin is null apparently" << std::endl; // If the plugin library still doesn't exist after a successful call of dlopen, then // we have managed to load something other than a (self-registering) eckit Plugin library std::ostringstream ss;