Skip to content

Commit

Permalink
Need to add -rdynamic to anything linking libsisl_logging.a (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd authored Feb 8, 2024
1 parent 08333b1 commit 4bc0ea8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class SISLConan(ConanFile):
name = "sisl"
version = "11.1.4"
version = "11.1.5"

homepage = "https://github.com/eBay/sisl"
description = "Library for fast data structures, utilities"
Expand Down Expand Up @@ -176,6 +176,9 @@ def package_info(self):
"nlohmann_json::nlohmann_json",
"spdlog::spdlog",
])
self.cpp_info.components["logging"].sharedlinkflags.append("-rdynamic")
self.cpp_info.components["logging"].exelinkflags.append("-rdynamic")

self.cpp_info.components["sobject"].libs = ["sisl_sobject"]
self.cpp_info.components["sobject"].set_property("pkg_config_name", f"libsisl_sobject")
self.cpp_info.components["sobject"].requires.extend([
Expand Down
2 changes: 1 addition & 1 deletion src/logging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ target_sources(sisl_logging PRIVATE
logging.cpp
stacktrace.cpp
)
target_link_libraries(sisl_logging PUBLIC ${LOGGING_DEPS})
target_link_libraries(sisl_logging PUBLIC ${LOGGING_DEPS} -rdynamic)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
Expand Down
6 changes: 4 additions & 2 deletions src/logging/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ LoggerThreadContext::~LoggerThreadContext() { m_logger_thread_registry->remove_l
void InitModules::init_modules(std::initializer_list< const char* > mods_list) {
assert(glob_num_mods + mods_list.size() <= MAX_MODULES);
for (const auto& mod : mods_list) {
if (std::string(mod).empty()) continue;
glob_enabled_mods[glob_num_mods++] = mod;
}
}
Expand Down Expand Up @@ -232,7 +233,7 @@ static spdlog::level::level_enum* to_mod_log_level_ptr(const std::string& module
const auto sym = std::string{"module_level_"} + module_name;
auto* mod_level = static_cast< spdlog::level::level_enum* >(::dlsym(RTLD_DEFAULT, sym.c_str()));
if (mod_level == nullptr) {
std::cout << fmt::format("Unable to locate the module {} in registered modules, error: {}\n", module_name,
std::cout << fmt::format("Unable to locate the module [{}] in registered modules, error: {}\n", module_name,
dlerror());
}
return mod_level;
Expand Down Expand Up @@ -272,6 +273,7 @@ static std::string setup_modules() {
auto mod_stream{std::istringstream(it->str())};
std::string module_name, module_level;
std::getline(mod_stream, module_name, ':');
if (module_name.empty()) continue;
const auto sym{std::string{"module_level_"} + module_name};
if (auto* const mod_level{static_cast< spdlog::level::level_enum* >(::dlsym(RTLD_DEFAULT, sym.c_str()))};
nullptr != mod_level) {
Expand All @@ -281,7 +283,7 @@ static std::string setup_modules() {
: spdlog::level::from_str(module_level.data());
}
} else {
std::cout << fmt::format("Unable to locate the module {} in registered modules, error: {}\n",
std::cout << fmt::format("Unable to setup the module [{}] in registered modules, error: {}\n",
module_name, dlerror());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/version/tests/test_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using namespace sisl;

SISL_OPTIONS_ENABLE(logging)
SISL_LOGGING_INIT(test_version)
SISL_LOGGING_INIT()

void entry() {
auto ver{version::Semver200_version(BOOST_PP_STRINGIZE(PACKAGE_VERSION))};
Expand Down

0 comments on commit 4bc0ea8

Please sign in to comment.