Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easylogging is out-of-date, but new version crashes #106

Open
bredelings opened this issue Feb 18, 2021 · 2 comments
Open

Easylogging is out-of-date, but new version crashes #106

bredelings opened this issue Feb 18, 2021 · 2 comments

Comments

@bredelings
Copy link
Contributor

otcetera includes an old version of the easylogging library. This generates a lot of warnings, and perhaps even errors under clang.

However, the newer version crashes at runtime. I think this has to do with calling INITIALIZE_EASYLOGGING from within a shared library.

==706333== Invalid write of size 8
==706333== at 0x229449: std::__recursive_mutex_base::__recursive_mutex_base() (mutex:76)
==706333== by 0x229477: std::recursive_mutex::recursive_mutex() (mutex:97)
==706333== by 0x2294A5: el::base::threading::ThreadSafe::ThreadSafe() (easylogging++.hpp:1040)
==706333== by 0x50A7C41: el::base::utils::AbstractRegistry<el::base::HitCounter, std::vector<el::base::HitCounter*, std::allocatorel::base::HitCounter* > >::AbstractRegistry() (easylogging++.hpp:1293)
==706333== by 0x50A5567: el::base::utils::RegistryWithPred<el::base::HitCounter, el::base::HitCounter::Predicate>::RegistryWithPred() (easylogging++.hpp:1483)
==706333== by 0x50A33BF: el::base::RegisteredHitCounters::RegisteredHitCounters() (easylogging++.hpp:2150)
==706333== by 0x509C1F8: el::base::Storage::Storage(std::shared_ptrel::LogBuilder const&) (easylogging++.cpp:2067)
==706333== by 0x5036231: __static_initialization_and_destruction_0(int, int) (otcli.cpp:12)
==706333== by 0x5036311: _GLOBAL__sub_I_otcli.cpp (otcli.cpp:275)
==706333== by 0x400FFB1: call_init.part.0 (dl-init.c:72)
==706333== by 0x40100B8: call_init (dl-init.c:30)
==706333== by 0x40100B8: _dl_init (dl-init.c:119)

The easylogging project doesn't seem very interested in fixing this.

Can we get the new version working simply moving INITIALIZE_EASYLOGGING out of the shared lib?

@bredelings
Copy link
Contributor Author

bredelings commented May 18, 2021

This old version is becoming more problematic. With gcc 11, we get a lot of warnings like:

Compiling C++ object ws/otc-tol-ws.p/tolwsbooting.cpp.o
In file included from ../../source/otc/otc_base_includes.h:14,
                 from ../../source/otc/newick_tokenizer.h:8,
                 from ../../source/otc/ws/tolws.h:13,
                 from ../../source/otc/ws/tolwsadaptors.h:4,
                 from ../../source/ws/tolwsbooting.cpp:13:
../../source/otc/easylogging++.hpp: In member function ‘el::Logger* el::base::RegisteredLoggers::get(const string&, bool)’:
../../source/otc/easylogging++.hpp:3822:85: warning: loop variable ‘h’ of type ‘const std::pair<std::__cxx11::basic_string<char>, std::shared_ptr<el::LoggerRegistrationCallback> >&’ binds to a temporary constructed from type ‘std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<el::LoggerRegistrationCallback> >’ [-Wrange-loop-construct]
 3822 |       for (const std::pair<std::string, base::type::LoggerRegistrationCallbackPtr>& h
      |                                                                                     ^
../../source/otc/easylogging++.hpp:3822:85: note: use non-reference type ‘const std::pair<std::__cxx11::basic_string<char>, std::shared_ptr<el::LoggerRegistrationCallback> >’ to make the copy explicit or ‘const std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<el::LoggerRegistrationCallback> >&’ to prevent copying
../../source/otc/easylogging++.hpp: In member function ‘void el::base::LogDispatcher::dispatch()’:
../../source/otc/easylogging++.hpp:4691:76: warning: loop variable ‘h’ of type ‘const std::pair<std::__cxx11::basic_string<char>, std::shared_ptr<el::LogDispatchCallback> >&’ binds to a temporary constructed from type ‘std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<el::LogDispatchCallback> >’ [-Wrange-loop-construct]
 4691 |     for (const std::pair<std::string, base::type::LogDispatchCallbackPtr>& h
      |                                                                            ^
../../source/otc/easylogging++.hpp:4691:76: note: use non-reference type ‘const std::pair<std::__cxx11::basic_string<char>, std::shared_ptr<el::LogDispatchCallback> >’ to make the copy explicit or ‘const std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<el::LogDispatchCallback> >&’ to prevent copying

@bredelings
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant