The following HowTo page which describes how to build libc++ with MSAN is outdated:
https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
I tried building libc++ (llmv 19) with those instructions, but I could not.
The section that did not work for me was the one that says:
Instrumented libc++
You need to build both [libc++](http://libcxx.llvm.org/) and [libc++abi](http://libcxxabi.llvm.org/) with MSan:
First, clone the LLVM source from github and enter a new build directory:
# clone LLVM
git clone --depth=1 https://github.com/llvm/llvm-project
cd llvm-project
mkdir build; cd build
# configure cmake
cmake -GNinja ../llvm \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_USE_SANITIZER=MemoryWithOrigins
# build the libraries
cmake --build . -- cxx cxxabi
Unfortunately, I do not remember well the errors I got as I tried it a few weeks ago.
I realize that it's not ideal for this bug report. But I see that the last edit in https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
is from May 21, 2020 (i.e. no edit in 5 years) so it's not surprising that the instructions are outdated.
I believe that MSAN could get many more users if the instruction to set it up were clearer and up-to-date. I struggled and failed to use it. I suspect I am not alone, and MSAN is rarely used outside of large companies like Google as a result, which are unfortunate missed opportunities to detect and fix bugs in many code repos.
The following HowTo page which describes how to build libc++ with MSAN is outdated:
https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
I tried building libc++ (llmv 19) with those instructions, but I could not.
The section that did not work for me was the one that says:
Unfortunately, I do not remember well the errors I got as I tried it a few weeks ago.
I realize that it's not ideal for this bug report. But I see that the last edit in https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
is from May 21, 2020 (i.e. no edit in 5 years) so it's not surprising that the instructions are outdated.
I believe that MSAN could get many more users if the instruction to set it up were clearer and up-to-date. I struggled and failed to use it. I suspect I am not alone, and MSAN is rarely used outside of large companies like Google as a result, which are unfortunate missed opportunities to detect and fix bugs in many code repos.