How can I compile libcxx with MemorySanitizer in MacOS and Linux?
A step-by-step description would be greatly appreciated but a bash script that
fetches trunk (and/or libcxx abi) from svn and compiles it would be enough.
This should probably be added to the documentation.
MemorySanitizer is not supported on OS X
(http://clang.llvm.org/docs/MemorySanitizer.html). You can compile
libc++ using AddressSanitizer or UndefinedSanitizer on OS X using the
cmake options -DLLVM_USE_SANITIZER=Address and
-DLLVM_USE_SANITIZER=Undefined respectively.
Support for building libc++ on OS X with sanitizers is experimental
and may not work. Let me know if you have any issues.
Do you know anything about compiling it with the MemorySanitizer under
Linux?
It seems that there is a circular dependency between libcxx and libcxxabi
but the docs do not really mention how to solve this (libcxx docs say it
needs libcxxabi and libcxxabi says it needs libcxx).
Do you know anything about compiling it with the MemorySanitizer under Linux?
Yes. You can use the '-DLLVM_USE_SANITIZER=Memory` or
`-DLLVM_USE_SANITIZER=MemoryWithOrigins`
when building libc++ and libc++ to build using MemorySanitizer.
It seems that there is a circular dependency between libcxx and libcxxabi but the docs do not really mention
how to solve this (libcxx docs say it needs libcxxabi and libcxxabi says it needs libcxx).
They both need each other :). However libc++abi only needs the libc++
headers, not the compiled library, so you build libc++abi first and
then build libc++ after.
It seems that there is a circular dependency between libcxx and
libcxxabi but the docs do not really mention how to solve this (libcxx
docs say it needs libcxxabi and libcxxabi says it needs libcxx).
libcxxabi's dependence on libcxx is only on libcxx's headers (i.e. there are no symbols from libcxx used in libcxxabi). The build system takes care of this for you.