-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Logging in a static function causes segfault #53
Comments
I got this sorted it. My build script was compiling against the static glog library and the dynamic gflags library. Here are how the combinations work out:
When using the dynamic glog library and the static gflags library, the program prints the following error at runtime:
|
I also encountered this problem, but it seems that sometimes the results of static links are normal. |
same problem here. libgflags.a(2.2.2) + libglog.a (0.4.0) cause crash when init LOGOBJECT, is there any root cause found about this issue? centos and debian both, other platform not testing log: |
…e with gflags/glog inconsistency see: google/glog#53
I declared a global variable, and in the constructor of that variable, I called glog to print logs. Then a segmentation fault occurred. In other words, the error occurred before the main method, in the constructor of the global variable.
|
Previously, logging from a static function used to work fine. It would just log to the console because
InitGoogleLogging()
hadn't been called yet.Now, logging from a static function causes the program to segfault.
Here's a short test program that demonstrates the problem. The
static bool b = f("...");
line triggers the crash. If that line is commented out, the program runs fine.Example stack trace from gdb:
The text was updated successfully, but these errors were encountered: