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
dll vs static build issues on Windows #103
Comments
It is possible to build a dll using the readymade MSVC projects. But not to link glog statically. |
BUT the readymade projects won't build 64-bit without modification. [AAARRRGH] |
Actually, CMake does offer an option to build DLLs: https://cmake.org/cmake/help/v3.5/variable/BUILD_SHARED_LIBS.html. This option applies to CMake enabled glog as well. |
By the way, as I'm aware that you are trying to build Ceres with glog on Windows, I must note that this is in fact possible. However, this requires minor changes in Ceres' |
Thanks Sergiu, Are you telling me I could get a dll build of glog just by setting a cmake // Annoying stuff for windows -- makes sure clients can import these functions /// even if they want to use the static library! -- TKS #ifndef GOOGLE_GLOG_DLL_DECL if defined(_WIN32) && !defined(CYGWIN)ifdef GLOG_STATICdefine GOOGLE_GLOG_DLL_DECLelsedefine GOOGLE_GLOG_DLL_DECL __declspec(dllimport)endifelsedefine GOOGLE_GLOG_DLL_DECLendif#endif Now defining GLOG_STATIC in all builds does the trick. -- Tom On Wed, Apr 20, 2016 at 5:27 AM, Sergiu Deitsch notifications@github.com
|
@tksharpless That's correct. Just by calling CMake using ``cmake -DBUILD_SHARED_LIBS:BOOL=ON` will generate a Visual Studio solution that produces DLLs. Unfortunately, CMake chose not to provide a default cache entry for the option which would allow to modify it via cmake-gui. But you can add the option yourself using the above command line call. As a side note, Ceres works with static glog as well. |
When I use this
To build glog shared library on Windows I get this error when I try to build the solution:
That line is this: GOOGLE_GLOG_DLL_DECL
int GetStackTrace(void** result, int max_depth, int skip_count) {
During build it must be export, during usage it must be import. I think Edit: This error is the current master. The release v0.3.5 compiles fine |
@dashesy I can confirm the problem. Can you please create a new issue since this problem is unrelated to the one of the original author? Thanks! |
Twin problems currently prevent using glog on Windows:
1] cmake offers no option to build a dll, creates only a static build
2] glog headers all assume a dll ("__declspec(dllimport)"), there is no check for static. So linking with the static library fails.
The text was updated successfully, but these errors were encountered: