<div dir="ltr">Hi everyone,<div><br></div><div>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:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">Undefined symbols for architecture x86_64:</font></div></div><div><div><font face="monospace, monospace">  "___ubsan_handle_dynamic_type_cache_miss", referenced from: <...></font></div></div><div><div><font face="monospace, monospace">  "___ubsan_vptr_type_cache", referenced from: <...></font></div></div><div><div><font face="monospace, monospace">ld: symbol(s) not found for architecture x86_64</font></div></div></blockquote><div><br></div><div>Looking at the generated ubsan dynamic library, those symbols are not present:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-family:monospace,monospace">kevin@cdrv:/usr/local/llvm/db79113/lib/clang/4.0.0/lib/darwin</span><br></div><div><div><font face="monospace, monospace">$ nm libclang_rt.ubsan_osx_dynamic.dylib | grep "ubsan_vptr_type_cache"</font></div></div></blockquote><div><br></div><div>However, with clang-3.8 provided by Homebrew, these symbols are indeed present:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">kevin@cdrv:/usr/local/Cellar/llvm38/3.8.0/lib/llvm-3.8/lib/clang/3.8.0/lib/darwin</font></div></div><div><div><font face="monospace, monospace">$ nm libclang_rt.ubsan_osx_dynamic.dylib | grep "ubsan_vptr_type_cache"</font></div></div><div><div><font face="monospace, monospace">0000000000b20c00 S ___ubsan_vptr_type_cache</font></div></div></blockquote><div><br></div><div>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:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">cmake -G "Ninja" ..                                  \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_C_COMPILER=/usr/bin/clang                \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_C_FLAGS="${INCLUDE_FLAGS}"               \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_CXX_COMPILER=/usr/bin/clang++            \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_CXX_FLAGS="${INCLUDE_FLAGS}"             \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_SHARED_LINKER_FLAGS="-L/usr/local/lib"   \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_BUILD_TYPE=Release                       \</font></div></div><div><div><font face="monospace, monospace">    -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" \</font></div></div><div><div><font face="monospace, monospace">    -DLLVM_ENABLE_EH=Yes                             \</font></div></div><div><div><font face="monospace, monospace">    -DLLVM_ENABLE_RTTI=Yes</font></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">cmake --build .</font></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">cmake --build . --target install</font></div></blockquote><div><br></div><div>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.</div><div><br></div><div>A bit of googling brought me to <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150622/283017.html">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150622/283017.html</a>, but I'm not sure if it's relevant to this particular issue.</div><div><br></div><div>Any idea what I could be missing?</div><div><br></div><div>Thanks,<br>Kevin</div></div>