UBSAN: undefined symbols when compiling on macOS Sierra (local config issue?)

Hi everyone,

I’m running into some issues when attempting to link while using the ‘undefined’ sanitizer – when linking my program, I’m getting errors of the form:

Undefined symbols for architecture x86_64:

“___ubsan_handle_dynamic_type_cache_miss”, referenced from: <…>

“___ubsan_vptr_type_cache”, referenced from: <…>

ld: symbol(s) not found for architecture x86_64

Looking at the generated ubsan dynamic library, those symbols are not present:


$ nm libclang_rt.ubsan_osx_dynamic.dylib | grep “ubsan_vptr_type_cache”

However, with clang-3.8 provided by Homebrew, these symbols are indeed present:


$ nm libclang_rt.ubsan_osx_dynamic.dylib | grep “ubsan_vptr_type_cache”

0000000000b20c00 S ___ubsan_vptr_type_cache

which I think implies I’m probably missing some bit of configuration when building clang with sanitizers. For reference, I’m building the LLVM tree with:

cmake -G “Ninja” … \

-DCMAKE_C_COMPILER=/usr/bin/clang \


-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \


-DCMAKE_SHARED_LINKER_FLAGS="-L/usr/local/lib" \





cmake --build .

cmake --build . --target install

This is built with ‘clang’ and ‘lldb’ checked out in the ‘llvm/tools’ folder, and ‘compiler-rt’, ‘openmp’, ‘libcxx’ and ‘libcxxabi’ checked out in the ‘llvm/projects’ folder, and the master branch from the various git mirrors for each project.

A bit of googling brought me to, but I’m not sure if it’s relevant to this particular issue.

Any idea what I could be missing?


You're hitting a bug which is fixed by this patch:
  [ubsan] Turn on 'Has CXXABI' to enable support for -fsanitize=vptr on Darwin

As a workaround, try building with:



Hi Vedant,

Just want to confirm that this did indeed work for me; thanks!