[cfe-users] Clang 3.6 and undefined symbol "ubsan::checkDynamicType"

Jeffrey Walton noloader at gmail.com
Wed Apr 1 17:38:51 PDT 2015


Hi Everyone,

I download and built Clang 3.6 from sources . The recipe can be found
at http://pastebin.com/snbuTzPK. The recipe fetches components with
wget, unpacks in them in the proper directory, configures, and kicks
off a build. The components are LLVM, CFE (Clang, front end),
Compiler-RT and Tools Extras.

I'm trying to use the Clang 3.6 Undefined and Address sanitizers. Link
is failing with the errors shown below.

The link rule include CXXFLAGS, so the sanitizer switches are being
passed through the compiler driver:

cryptest.exe: libcryptopp.a $(TESTOBJS)
    $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)

And is on path:

$ find /usr/local/ -iname libclang_rt.ubsan_osx.a
/usr/local//lib/clang/3.6.0/lib/darwin/libclang_rt.ubsan_osx.a

Any ideas what I am doing wrong?

Thanks in advance.

====================

$ find /usr/local/ -iname *ubsan*
/usr/local//lib/clang/3.6.0/lib/darwin/libclang_rt.ubsan_osx.a

$ export DYLD_LIBRARY_PATH=/usr/local//lib/clang/3.6.0/lib/darwin

$ make test 2>&1 | asan_symbolize.py
/usr/local/bin/clang++ -o cryptest.exe -DNDEBUG -g3 -Os -fPIC
-fsanitize=address -fsanitize=undefined -Wall
-Wno-tautological-compare -Wno-unused-value -Wno-unused-variable
-Wno-unused-parameter -Wno-unused-function -DCRYPTOPP_DISABLE_ASM
-pipe bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o
datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a
Undefined symbols for architecture x86_64:
  "typeinfo for __cxxabiv1::__class_type_info", referenced from:
      __ubsan::checkDynamicType(void*, void*, unsigned long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
      isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,
__cxxabiv1::__class_type_info const*, long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
      findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
  "typeinfo for __cxxabiv1::__si_class_type_info", referenced from:
      isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,
__cxxabiv1::__class_type_info const*, long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
      findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
  "typeinfo for __cxxabiv1::__vmi_class_type_info", referenced from:
      isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,
__cxxabiv1::__class_type_info const*, long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
      findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [cryptest.exe] Error 1



More information about the cfe-users mailing list