You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a cross-platform (Linux & Windows) Qt Application that uses glog for logging (commit: 4d391fe). The project has a main application with several shared libraries that we wrote. On Linux (Ubuntu 14.04) glog works as expected. On Windows (built using mingw-w64 and gcc) any log statement that comes from within a DLL gets written to stdout instead of to the log. Any log statement from within the main application correctly gets written to the log. Furthermore, I see WARNING: Logging before InitGoogleLogging() is written to STDERR in the standard output for each time a log statement is created from a DLL for the first time (i.e. if I have 5 DLLs, I see that warning 5 times immediately prior to the first log statement from each DLL).
It seems like Glog is not being shared across the DLLs. I have tried to call InitGoogleLogging from within each DLL to test this theory, but then I get a run time crash with the following error message in stdout: Check failed: !IsGoogleLoggingInitialized() You called InitGoogleLogging() twice!. So it appears that Glog is not being shared however, I can't initialize it in each DLL.
Full disclosure: I had to tweak port.h in order to get glog to build in mingw-w64 by handling pthreads correctly and not redefining localtime_r, but I don't feel this is related.
Also encountered the windows/port.h issue when trying to cross-compile.
Another issue to mention. The headers that are make installed still have the __declspec(dllimport) macro definitions, even when the build is configured to produce a static library. They cause "undefined reference to imp[some mangled symbol]" error when linking.
I have the same problem, but in Linux. How should someone approach these situations, in which a dynamic library uses Glog, and my client application also uses Glog? They cannot both call InitGoogleLogging. But the dynamic library cannot drop that Logging initialization call because it can be used in applications without Glog. Shouldn't exist something like InitGoogleSharedLogging?
Moreover, how to approach cases when the shared library and the main client use different versions of a library or one of them has Glog coupled with Gflags and the other not? How to make each one point to its "rightful" library?
I have a cross-platform (Linux & Windows) Qt Application that uses glog for logging (commit: 4d391fe). The project has a main application with several shared libraries that we wrote. On Linux (Ubuntu 14.04) glog works as expected. On Windows (built using mingw-w64 and gcc) any log statement that comes from within a DLL gets written to stdout instead of to the log. Any log statement from within the main application correctly gets written to the log. Furthermore, I see
WARNING: Logging before InitGoogleLogging() is written to STDERR
in the standard output for each time a log statement is created from a DLL for the first time (i.e. if I have 5 DLLs, I see that warning 5 times immediately prior to the first log statement from each DLL).It seems like Glog is not being shared across the DLLs. I have tried to call InitGoogleLogging from within each DLL to test this theory, but then I get a run time crash with the following error message in stdout:
Check failed: !IsGoogleLoggingInitialized() You called InitGoogleLogging() twice!
. So it appears that Glog is not being shared however, I can't initialize it in each DLL.Full disclosure: I had to tweak port.h in order to get glog to build in mingw-w64 by handling pthreads correctly and not redefining localtime_r, but I don't feel this is related.
The text was updated successfully, but these errors were encountered: