-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bb): working msan preset (#4618)
This creates a working memory sanitizer preset, but woe be to those who try and use it outside of this docker script, as it requires very fiddly building of LLVM. Shoutout to this json_struct project for the magic incantations: https://github.com/jorgen/json_struct/blob/89ca33179790d1e82ecb95092cd469f96c3ff06e/docker/ubuntu22.04/Dockerfile#L23 (bullish on searching github for dockerfiles) To use: `./scripts/docker_interactive.sh msan.ubuntu` After initial setup, this will run instantly, and you will be in a setup with LLVM MSAN set up. Only then will: `cmake --preset msan && cmake --build --preset msan` will work. Currently not everything builds, and some stuff uncovers issues, but I will decouple that. --------- Co-authored-by: ludamad <[email protected]>
- Loading branch information
Showing
3 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
43 changes: 43 additions & 0 deletions
43
barretenberg/cpp/dockerfiles/interactive/Dockerfile.msan.ubuntu
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM ubuntu:lunar | ||
|
||
RUN apt update && apt install -y \ | ||
build-essential \ | ||
curl \ | ||
git \ | ||
cmake \ | ||
lsb-release \ | ||
wget \ | ||
software-properties-common \ | ||
gnupg \ | ||
ninja-build \ | ||
npm \ | ||
libssl-dev \ | ||
jq \ | ||
bash \ | ||
libstdc++6 | ||
|
||
RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 16 | ||
|
||
ENV CXX=clang++-16 | ||
ENV CC=clang-16 | ||
|
||
RUN git clone --depth 1 -b release/16.x https://github.com/llvm/llvm-project | ||
|
||
RUN cd llvm-project | ||
|
||
RUN mkdir llvm-project/build | ||
|
||
RUN cmake -G Ninja -S llvm-project/runtimes -B llvm-project/build \ | ||
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \ | ||
-DLLVM_USE_SANITIZER=MemoryWithOrigins \ | ||
-DCMAKE_INSTALL_PREFIX=/opt | ||
|
||
RUN ninja -C llvm-project/build cxx cxxabi | ||
RUN ninja -C llvm-project/build install-cxx install-cxxabi | ||
|
||
ENV MSAN_CFLAGS="-std=c++20 -fsanitize=memory -nostdinc++ -I/opt/include -I/opt/include/c++/v1" | ||
ENV MSAN_LFLAGS="-fsanitize=memory -stdlib=libc++ -L/opt/lib -lc++abi -Wl,-rpath,/opt/lib" | ||
|
||
WORKDIR /usr/src/barretenberg/cpp | ||
|
||
CMD ["/bin/bash"] |
This file contains 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