-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[boost] Pass sanitizer settings to b2 #6513
Conversation
I detected other pull requests that are modifying boost/all recipe:
This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there. |
This comment has been minimized.
This comment has been minimized.
@@ -958,6 +958,16 @@ def add_defines(library): | |||
if self.settings.get_safe("compiler.cppstd"): | |||
flags.append("cxxflags=%s" % cppstd_flag(self.settings)) | |||
|
|||
if self.settings.get_safe("compiler.sanitizer"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
settings.compiler
is not an "official" setting.
It's documented, but I think more as an example.
They should have added it to the default settings.yml
, if they wanted it to have more support.
Also, it would be weird if only boost would need to listen to this flag. The zlib recipe will ignore compiler.sanitizer
.
Can you be more specific about what does not work when you add the following to your profile?
[env]
CXXFLAGS=-fsanitize=thread
Boost has the option -o boost:debug_level=X
to give more verbose build logs.
Perhaps there you can see what is not working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's time to refresh old issue: conan-io/conan#1346
as sanitizers are getting more and more popularity in C++ community, I feel like they should get more love from conan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't conan just add -fsanitize=xxx
to CFLAGS/CXXFLAGS/LDFLAGS
when the sanitizers are enabled?
Then we end up in the same situation.
Of course, then we are able to handle this specific case here in the boost recipe, but I still feel that this is a case of some flags not passing through correctly.
I didn't test this locally yet, so I don't know what the problem is yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if it's that simple. some sanitizers may require more flags (e.g. see https://clang.llvm.org/docs/ControlFlowIntegrity.html). or might be incompatible with some flags.
but in 99% of cases, I think you're right, it should just imply -fsanitize=xxx
.
If boost does not listen to your |
This comment has been minimized.
This comment has been minimized.
@SSE4 could you please comment on how do I approach this "An unexpected error happened and has been reported" thing? I how no idea what happened. And where it has been reported :) |
that I see in logs is just:
unfortunately these errors happen from time to time. we even have re-tries for these code paths, but they don't always help. you can't do anything better than just restarting the build. one possible way to do it:
|
All green in build 5 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, prefer 4 spaces instead of 2, because this file uses 4 spaces everywhere.
When using the following profile, named
with the current boost recipe:
All calls to Even more, it looks like the thread sanitizer is not happy with the fiber test:
So I don't really see the need for this pr. |
This pr has the same result with the fiber test:
Also, the test package does not work out of the box because conan does not add I added this to the test package as a quick fix: --- a/recipes/boost/all/test_package/conanfile.py
+++ b/recipes/boost/all/test_package/conanfile.py
@@ -17,6 +17,8 @@
# FIXME: tools.vcvars added for clang-cl. Remove once conan supports clang-cl properly. (https://github.com/conan-io/conan-center-index/pull/1453)
with tools.vcvars(self.settings) if (self.settings.os == "Windows" and self.settings.compiler == "clang") else tools.no_op():
cmake = CMake(self)
+ cmake.definitions["CMAKE_CXX_FLAGS"] = "-fsanitize=thread"
+ cmake.definitions["CMAKE_EXE_LINKER_FLAGS"] = "-fsanitize=thread"
cmake.definitions["HEADER_ONLY"] = self.options["boost"].header_only
if not self.options["boost"].header_only:
cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared |
@madebr it seems like sanitizer seg-faults in your case? |
Yup, in both cases the thread sanitizer failed in the fiber example. |
@madebr thanks for the info!
boost has A LOT of things, so I believe there is still point in having sanitized package, even though something does not work. And it does not work in a very loud way, which is a good thing. |
See mmatrosov#1 |
I tried adding So it seems there is indeed no need in this PR. I am going to close it soon. Let me know if you see any value in it. |
Does the test package work for you? |
Hm, I am currently having troubles building the test package at all:
UPD: I get it, I have an older recipe revision in the cache. |
Can you post the complete output of |
I was able to build and run the test package without any modifications. It stops with |
Yup, you observe the same error as I do. |
It's hard to tell, I do not have any experience with boost::fibers |
So let's close this pr? |
if this PR addresses segfault, let's merge it as an improvement |
@mmatisko |
Not sure which segfault are you talking about. If your mean fibers test, then I observe exactly the same errors with and without the PR (including @madebr's changes). |
yes, fibers one:
|
Ok, then as I've said, this problem is not affected by the PR, and thus I believe it should be closed. Thanks a lot for your feedback! |
Specify library name and version: boost/all
Thread sanitizer requires all linked code to be instrumented in order to work properly (https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual#non-instrumented-code). Thus, it makes sense to support packages built with thread sanitizer.
I assume that
compiler.sanitizer
setting is defined as in the docs: https://docs.conan.io/en/latest/howtos/sanitizers.htmlSpecifying
CXXFLAGS=-fsanitize=thread
env in the profile indeed works for all other libraries that I tried, but not for boost. If I specify this env, boost not only does not build with the sanitizer, but also does not link with zlib. It is not clear to me why this happens, but the proper way to build boost with sanitizers is to pass this option directly tob2
: https://www.boost.org/doc/libs/1_76_0/tools/build/doc/html/index.html#_sanitizersThat's exactly what I do in this PR. If
compiler.sanitizer
setting is notNone
, I pass it as an appropriate flag tob2
.conan-center hook activated.