-
Notifications
You must be signed in to change notification settings - Fork 340
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
Remove address sanitizer from project build #408
Conversation
@rotu I understand the problem and I am ok with just not enabling address sanitizer by default in a debug build. What I don't understand is why you propose removing it from CMakeLists.txt altogether: I find it rather convenient that I can switch between sanitizers (or none at all) by just doing |
The reason I think it doesn’t belong in project build files is because those options must be chosen with the consuming app in mind. If you always want your debug builds to have asan, it might make sense to add those flags to If you still feel this belongs here, I will restore that project build option. |
@rotu adding it to If instead if it is an environment variable, then simply setting it globally would mess up everything else. So that doesn't seem like such a good idea either. An environment variable like CYCLONEDDS_USE_SANITIZER could perhaps be an option. How about you split this PR into one that just changes the default behaviour to not automatically enable address sanitizer, and another one proposing a change to the way address sanitizer is enabled in the first place? Then I can already merge the former while having some more time to decide on the second, or get input from other people with more knowledge of CMake than I have. (Any ideas, @k0ekk0ek?) |
I actually intended for some comments but didn't get around to it yet. I think we may want to have a look at CMAKE_CONFIGURATION_TYPES. Next to Debug we could then have a |
Also, allow multiple sanitizers. Signed-off-by: Dan Rose <dan@digilabs.io>
Alright. I rolled back the scope of this PR. I still don't know the best way forward, but I think this is good enough for now |
Thanks @rotu, not merely for rolling back but also improving in the process. I'm certain this is a step in the right direction, and at least it solves the problems caused by enabling the address by default. I was wondering whether perhaps this one of the things toolchain files are for ... |
It's a great use for toolchain files. It's also a good use for Colcon's defaults.yaml. Or for creating a direnv script to set CFLAGS / CXXFLAGS / LDFLAGS. |
2. Remove asan logic in the library build process.The correct way to hook up address sanitizer depends on the eventual application using it and whether CycloneDDS is statically or dynamically linked.
Doing it improperly results in runtime crashes like:
Signed-off-by: Dan Rose dan@digilabs.io