This repository was archived by the owner on May 6, 2021. It is now read-only.
Extend autobuilder to support options for clang, -Wall -Weverything -Wpedantic, ThreadSanitizer, AddressSanitizer, and Clang's static analyzer.#22
Open
dwm wants to merge 7 commits into
Open
Conversation
Modify the various build-script variants to use CC and CXX, rather than asuming the use of gcc and g++ --- though they will still use these by default if no other compiler is specified.
If the auto-builder's hostname contains '-clang', then build Ceph using the clang and clang++ compilers, rather than using the default.
Rather than replace the definitions of CFLAGS and CXXFLAGS when calling configure, instead prepend to those variables. This allows use to later define CFLAGS and CXXFLAGS values in the calling environment.
Update build-auto.sh to check the hostname for additional elements:
-asan: Enable AddressSanitizer in subsequent compilations, which
introduces extra safety-features at program run-time.
-tsan: Enable ThreadSanitizer in subsequent compilations, which
introduces extra safety-features at program run-time.
-wall: Enable -Wall, -Wpedantic, -Weverything flags in subsequent
compilations.
Note that, at least as of clang-3.5, the AddressSanitizer and
ThreadSanitizer options are mutually incompatible.
At time of writing, Ceph fails to build with -Wall -Wpedantic
-Weverthing flags defined part-way through compiling rocksdb, because
-Werror is also defined at that point.
(Of course, subsequent compilation errors may well, and even are
likely, to occur; this is just the first one we hit.)
Clang and distcc (particulrly versions of distcc < 3.2) interact in some undesirable ways: Specifically, clang (with all warnings enabled) can generate spurious warnings (or errors, if -Werror is defined)! that are the result of preprocessing files and compiling in separate stages. Work around by exporting 'CCACHE_CPP2=yes' and definding '-Qunused-arguments' in CFLAGS and CXXFLAGS. See for further discussion: http://petereisentraut.blogspot.co.uk/2011/05/ccache-and-clang.html *
Add 'clang' (and, on Redhat machines, 'clang-analyzer') to the set of packages to provision.
Add support for wrapping the top-level 'make' invocation with the contents of the BUILD_WRAPPER environment variable, and define this variable on hosts with the -analyze suffix present. Also disable the use of CCACHE in this case; it seems likely that these two facilities might interact poorly. This might be overly conservative, however. Note that while the static-analyzer is part of the clang project, its use does not imply that compilation must use clang; hence if you wish to both static-analyze and build Ceph with clang, then both the -analyze and -clang hostname suffixes are required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a small series of commits that adds support for:
These can be enabled by building on a host with '-clang', '-wall', '-asan', '-tsan', and '-analyze' hostname affixes defined, respectively.
(Note that, at least for Clang 3.5, AddressSanitizer and ThreadSanitizer compilation options are mutually-exclusive.)
This series also updates fabfile.py to add the 'clang' package (and the 'clang-analyzer' package on RPM-based systems) to build-hosts.
These changes are untested, though are simple enough that they're pretty likely to work, modulo any uncaught typos.
I may also not have caught all of the different build-cases of interest, as some of the build-scripts hand off to RPM spec files or debian/rules files not stored within the tree. It's also not clear which of the current build scripts might be obsolete.
Manual testing of these compile-time options shows that: