I am trying to use --thread-sanitizer
option of clang on OSX:
$ clang++ -fthread-sanitizer -fpic tsan1.cc
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
[...]
clang -cc1 version 4.2 based upon LLVM 3.2svn default target x86_64-apple-darwin12.3.0
[...]
Undefined symbols for architecture x86_64:
"___tsan_func_entry", referenced from:
threadfunc(void*) in tsan1-6f7gbr.o
[...]
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Looks like a linkage error. Should I link with some additional libs?
ThreadSanitizer is unsupported on Darwin for C++ yet. This is unlikely to change in at least half a year.
It's been fixed. According to https://clang.llvm.org/docs/ThreadSanitizer.html
ThreadSanitizer is supported on the following OS: ... Darwin arm64, x86_64, ...
Also I just used it without any problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With