Alex Trebek via llvm-dev
2019-Jun-09 19:02 UTC
[llvm-dev] Fwd: Issue Compiling DFSan Example (I mailed the wrong list :|)
I didn't realize I needed to join the mailing list owo I'm attempting to compile the DataFlow Sanitizer example on the clang site ( https://clang.llvm.org/docs/DataFlowSanitizer.html) using clang9 that I compiled from the llvm source. However, I'm getting error messages stating several types (defined in stdint.h) aren't defined. I've confirmed they're defined and that the compiler finds them in stdint.h, in my /usr/local/include path. To troubleshoot, I also included stdint.h in the source and declared a uint16_t variable, tm, but it still says it doesn't recognize the type. The example program: #include <stdint.h> #include <sanitizer/dfsan_interface.h> #include <assert.h> int main(void) { uint16_t tm; int i = 1; dfsan_label i_label = dfsan_create_label("i", 0); dfsan_set_label(i_label, &i, sizeof(i)); int j = 2; dfsan_label j_label = dfsan_create_label("j", 0); dfsan_set_label(j_label, &j, sizeof(j)); int k = 3; dfsan_label k_label = dfsan_create_label("k", 0); dfsan_set_label(k_label, &k, sizeof(k)); dfsan_label ij_label = dfsan_get_label(i + j); assert(dfsan_has_label(ij_label, i_label)); assert(dfsan_has_label(ij_label, j_label)); assert(!dfsan_has_label(ij_label, k_label)); dfsan_label ijk_label = dfsan_get_label(i + j + k); assert(dfsan_has_label(ijk_label, i_label)); assert(dfsan_has_label(ijk_label, j_label)); assert(dfsan_has_label(ijk_label, k_label)); return 0; } The verbose error messages: user at box:~/Desktop/test$ clang -v -fsanitize=dataflow dfsOne.cpp user at box:~/Desktop/test$ clang -v -fsanitize=dataflow dfsOne.cpp clang version 9.0.0 (https://github.com/llvm/llvm-project.git 2ba0e2518b96392f9f2352d10fc5a27bbbc92fa9) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/user/Desktop/tools/llvm-project/build/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8 Candidate multilib: .;@m64 Selected multilib: .;@m64 "/usr/local/bin/clang-9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name dfsOne.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/9.0.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/user/Desktop/test -ferror-limit 19 -fmessage-length 0 -fsanitize=dataflow -fsanitize-blacklist=/usr/local/lib/clang/9.0.0/share/dfsan_abilist.txt -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/dfsOne-2ed122.o -x c++ dfsOne.cpp clang -cc1 version 9.0.0 based upon LLVM 9.0.0svn default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8 /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8 /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward /usr/local/include /usr/local/lib/clang/9.0.0/include /usr/include/x86_64-linux-gnu /usr/include End of search list. In file included from dfsOne.cpp:3: In file included from /usr/local/include/sanitizer/dfsan_interface.h:18: /usr/local/include/sanitizer/common_interface_defs.h:33:5: error: unknown type name 'intptr_t' intptr_t coverage_fd; ^ /usr/local/include/sanitizer/common_interface_defs.h:60:3: error: unknown type name 'uint16_t' uint16_t __sanitizer_unaligned_load16(const void *p); ^ /usr/local/include/sanitizer/common_interface_defs.h:61:3: error: unknown type name 'uint32_t' uint32_t __sanitizer_unaligned_load32(const void *p); ^ /usr/local/include/sanitizer/common_interface_defs.h:62:3: error: unknown type name 'uint64_t' uint64_t __sanitizer_unaligned_load64(const void *p); ^ /usr/local/include/sanitizer/common_interface_defs.h:63:47: error: unknown type name 'uint16_t' void __sanitizer_unaligned_store16(void *p, uint16_t x); ^ /usr/local/include/sanitizer/common_interface_defs.h:64:47: error: unknown type name 'uint32_t' void __sanitizer_unaligned_store32(void *p, uint32_t x); ^ /usr/local/include/sanitizer/common_interface_defs.h:65:47: error: unknown type name 'uint64_t' void __sanitizer_unaligned_store64(void *p, uint64_t x); ^ In file included from dfsOne.cpp:3: /usr/local/include/sanitizer/dfsan_interface.h:24:9: error: unknown type name 'uint16_t' typedef uint16_t dfsan_label; ^ dfsOne.cpp:7:2: error: unknown type name 'uint16_t' uint16_t tm; ^ 9 errors generated. I've also attempted to build via cmake with the following CmakeLists.txt file (same errors though, I'm using cmake 3.5.1): cmake_minimum_required (VERSION 2.6) project (EXAMPLE) add_executable(dfsOne dfsOne.cpp) SET (CMAKE_CXX_STANDARD 11) SET (CMAKE_CXX_STANDARD_REQUIRED ON) SET (CMAKE_C_COMPILER "/home/user/Desktop/tools/llvm-project/build/bin/clang") SET (CMAKE_C_FLAGS "-fsanitize=dataflow") Any ideas why the compiler doesn't know the types even though I import stdint.h? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190609/76599fd3/attachment.html>