Closed ceandrade closed 1 year ago
glog is deprecated. OR-Tools contains a re-implementation of glog, but on top of the abseil-cpp package. It seems that easylogging is also a reimplementation of easylogging++.
The path forward for us is to wait for glog to be fully re-implemented in abseil-cpp (it is only done partially), then we will drop on glog reimplementation.
You could try moving from easylogging to the ortools/base/logging.h. The main diff I see is the parsing of the parameters, which is done using the abseil flags module. See https://github.com/google/or-tools/blob/stable/examples/cpp/jobshop_sat.cc#L876
Or you can try encapsulating or-tools to never be included alongside easylogging.
Now, the crash may not be related to easylogging interaction.
0) Unfortunately Easylogging++ and base logging use the same macro name => conflict/undefined behaviour.
1) Glog is no more maintained/use by Google and is currently maintained by the community. so If I were you...
2) you may try to hack ortools base logging to reuse easylogging++ if semantic is identical aka logging.h become a proxy to include easylogging header etc...
3) base/logging is just an ugly hack of Glog BUT using absl::flags instead of gflags (which is also dead and already replaced by absl::flags)
4) We are waiting for absl::logging
literally for years (2019 IIRC) but maybe 2022 will be the year !
So base/logging may be wipeout in favor of abs::logging in a near future...
Some ref:
I fear abseil-cpp:log will also contains conflicting macro with easylogging++ so the migration won't fix conflicts currently... https://github.com/abseil/abseil-cpp/search?q=VLOG_IS_ON
I fear abseil-cpp:log will also contains conflicting macro with easylogging++ so the migration won't fix conflicts currently... https://github.com/abseil/abseil-cpp/search?q=VLOG_IS_ON
Did something change here? The search returns zero results which is probably not what you saw?
I guess "commit: Remove internal VLOG_xxx macros" might change something?
Some news. I pushed the code on main that uses the new abseil, as well as implement the VLOG macros. (see ortools/base/vlog.h).
At this point, I will close the bug as the way forward is just to wait for vlog to be implemented in abseil to remove our code.
Version: 9.3 both pre-compiled packages and compiled source code Language: C++, GCC 10, Clang 12.0.5 OS: MacOS X 11.6.5 , Mint Linux 20.4, CentOS 7. Using: CP-SAT
I have a very large project/codebase that uses Easylogging++ as the main logging tool. WHen using Google OR-Tools and compiling with optimization flags (-O2 or -O3), the execution results in a segmentation fault.
Suppose we have this very simple code:
We can compile using something like:
The compilation of this code results in several issues, as following, but it compiles:
You can see that this is very problematic and it is almost sure the source of the problem. Obviously, the warning depends on the headers' order, i.e., if you add the Easylogging header after Google OR-tools headers, Easylogging will redefine the macros of the latter.
This is a trace using GDB:
Valgrind catches for Easylogging++ side:
The last traces were for the simple example. In my application, the issues propagate to other parts:
One way to solve this problem is to drop Easylogging++. But this is really a hard sell because it is the de-facto logging this project uses. Many people will be upset to change to something else.
So, is there a way to disable or wrap the OR-Tools logging facilities? This would be the best option.
Now, to upset my fellow devs, I could argue to move to [Google Logging Library]((https://github.com/google/glog)? Is Google OR-Tools compatible in this case?
Thanks!