-
Notifications
You must be signed in to change notification settings - Fork 219
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
google sanitizers can be turned off for debug builds #424
Conversation
The point of a debug build is to check as much as possible. I am not sure I understand why you want to make a debug build and not run the sanitizers. Why would you not use a release build? I am happy to take the PR if it makes sense, but I do not understand the reasoning. Can you please explain? |
Thanks for the feedback, I totally get your point. The only thing is if you "include" libplctag in another project, (using This kind of impose to other parts of the project to use sanitizers in debug mode no matter what. For a big code base, this is a big constraint, compile and run time could be massively affected. Another solution would be to use libplctag in release mode, in a debug build, possible but a little bit ashamed as we could not break in and get proper stack if crash append in the lib. Ence why I think optional sanitizer (with of course default |
Hmm, that makes some sense. What kind of other libraries are you including in the project? |
Basically all our own code + a lot of extra third party lib related to other PLC / protocol. Like I said I can also "include" libplctag differently, this is just that cmake fetch_content is somehow practical. On that note the fact that the linux static lib is renamed (.a lib versus cmake target) make use of fecth_content non straight forward. I think if you want to increate ease-of integration in other based-cmake projects, there is some minimal changes that can enable this. Maybe I can prepare anothre PR to open the discussion. |
@vrince I was looking into creating a vcpkg port for libplctag, but I encountered an issue that may be fixed by a PR that makes the CMake files a bit more fetch_content friendly.
The main issue is that during static builds the dynamic libraries are built anyway, I haven't checked the other way, but I would guess that the static libraries are built during a shared build. Currently I am working around this by removing the shared library files after the build process, but ideally we wouldn't waste the effort of building the unnecessary files in the first place. Do you think this issue could be fixed in the small PR you were thinking about, or do you think that would that require a more substantial refactoring of the CMake files? |
On Linux it's pretty straightforward to have static lib only, it's been a while since I pulled my hair trying to build something on Windows, so maybe you are right simply setting |
@vrince I have done some work on creating a patch which will permit libplctag to integrate with the vcpkg build system. I did have to use a conditional to separate the static and shared builds. You can see my patch for the pending vcpkg port at cmake.patch. The problem with static and shared library building on windows is that the static library extension
I have an open issue (#435) to discuss some of the changes I made to make libplctag more friendly for vcpkg. If you think it will be helpful, I can push my vcpkg branch of libplctag to github. |
The goal is to make sanitizers optional, so I introduced the
USE_SANITIZERS
cmake option that isON
by default to maintain the current behavior.closes #423
To build with :
to build without: