Skip to content

Commit

Permalink
feat: Add Conan profiles for common Sanitizers to docker ci image (#1856
Browse files Browse the repository at this point in the history
)

For #1049
  • Loading branch information
godexsoft authored Jan 29, 2025
1 parent 81fe617 commit 3e200d8
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docker/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ This image contains an environment to build [Clio](https://github.com/XRPLF/clio
It is used in [Clio Github Actions](https://github.com/XRPLF/clio/actions) but can also be used to compile Clio locally.

The image is based on Ubuntu 20.04 and contains:
- clang 16
- clang 16.0.6
- gcc 12.3
- doxygen 1.10
- doxygen 1.12
- gh 2.40
- ccache 4.8.3
- conan
- ccache 4.10.2
- conan 1.62
- and some other useful tools

Conan is set up to build Clio without any additional steps. There are two preset conan profiles: `clang` and `gcc` to use corresponding compiler.
Conan is set up to build Clio without any additional steps. There are two preset conan profiles: `clang` and `gcc` to use corresponding compiler. By default conan is setup to use `gcc`.
Sanitizer builds for `ASAN`, `TSAN` and `UBSAN` are enabled via conan profiles for each of the supported compilers. These can be selected using the following pattern (all lowercase): `[compiler].[sanitizer]` (e.g. `--profile gcc.tsan`).
9 changes: 9 additions & 0 deletions docker/ci/conan/clang.asan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(clang)

[options]
boost:extra_b2_flags="cxxflags=\"-fsanitize=address\" linkflags=\"-fsanitize=address\""
boost:without_stacktrace=True
[env]
CFLAGS="-fsanitize=address"
CXXFLAGS="-fsanitize=address"
LDFLAGS="-fsanitize=address"
9 changes: 9 additions & 0 deletions docker/ci/conan/clang.tsan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(clang)

[options]
boost:extra_b2_flags="cxxflags=\"-fsanitize=thread\" linkflags=\"-fsanitize=thread\""
boost:without_stacktrace=True
[env]
CFLAGS="-fsanitize=thread"
CXXFLAGS="-fsanitize=thread"
LDFLAGS="-fsanitize=thread"
9 changes: 9 additions & 0 deletions docker/ci/conan/clang.ubsan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(clang)

[options]
boost:extra_b2_flags="cxxflags=\"-fsanitize=undefined\" linkflags=\"-fsanitize=undefined\""
boost:without_stacktrace=True
[env]
CFLAGS="-fsanitize=undefined"
CXXFLAGS="-fsanitize=undefined"
LDFLAGS="-fsanitize=undefined"
9 changes: 9 additions & 0 deletions docker/ci/conan/gcc.asan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(gcc)

[options]
boost:extra_b2_flags="cxxflags=\"-fsanitize=address\" linkflags=\"-fsanitize=address\""
boost:without_stacktrace=True
[env]
CFLAGS="-fsanitize=address"
CXXFLAGS="-fsanitize=address"
LDFLAGS="-fsanitize=address"
9 changes: 9 additions & 0 deletions docker/ci/conan/gcc.tsan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(gcc)

[options]
boost:extra_b2_flags="cxxflags=\"-fsanitize=thread\" linkflags=\"-fsanitize=thread\""
boost:without_stacktrace=True
[env]
CFLAGS="-fsanitize=thread"
CXXFLAGS="-fsanitize=thread"
LDFLAGS="-fsanitize=thread"
9 changes: 9 additions & 0 deletions docker/ci/conan/gcc.ubsan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(gcc)

[options]
boost:extra_b2_flags="cxxflags=\"-fsanitize=undefined\" linkflags=\"-fsanitize=undefined\""
boost:without_stacktrace=True
[env]
CFLAGS="-fsanitize=undefined"
CXXFLAGS="-fsanitize=undefined"
LDFLAGS="-fsanitize=undefined"
7 changes: 7 additions & 0 deletions docker/ci/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,10 @@ RUN conan profile new clang --detect \
&& conan profile update "conf.tools.build:compiler_executables={\"c\": \"/usr/bin/clang-16\", \"cpp\": \"/usr/bin/clang++-16\"}" clang

RUN echo "include(gcc)" >> .conan/profiles/default

COPY conan/gcc.asan /root/.conan/profiles
COPY conan/gcc.tsan /root/.conan/profiles
COPY conan/gcc.ubsan /root/.conan/profiles
COPY conan/clang.asan /root/.conan/profiles
COPY conan/clang.tsan /root/.conan/profiles
COPY conan/clang.ubsan /root/.conan/profiles

0 comments on commit 3e200d8

Please sign in to comment.