JacobNowitsky
JacobNowitsky

Reputation: 11

llvm error when attempt to build libcxx instrumented with memory sanitizer

I'm trying to fix MemorySanitizer issue @https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo. I run:

cmake -GNinja ../llvm \
    -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DLLVM_USE_SANITIZER=MemoryWithOrigins

But got the error:

libcxx isnt a known project, did you mean to enable it as a runtime LLVM_ENABLE_RUNTIMES

How to fix it?

More information about initial problem - under the link: Using memory sanitizer with libstdc++

My issue is the same - memory sanitizer points to uninitialized values where it should not.

Upvotes: 1

Views: 262

Answers (1)

JacobNowitsky
JacobNowitsky

Reputation: 11

Solution is below:

~/llvm-project/llvm/CMakeList.txt

set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind")
set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload")
set(LLVM_ENABLE_RUNTIMES "libunwind" CACHE STRING

build command:

cmake -GNinja ../llvm      -DCMAKE_BUILD_TYPE=Release      -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi"       -DCMAKE_C_COMPILER=clang    -DCMAKE_CXX_COMPILER=clang++    -DLLVM_USE_SANITIZER=MemoryWithOrigins

second part derived to LLVM Build Fails with MemorySanitizer Enabled

Upvotes: 0

Related Questions