<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hello,<div><br></div><div>I'm not sure if this is the right place to post this question. If not, I apologize and would appreciate if you redirect me.</div><div><br></div><div>I recently built and installed llvm/clang in order to build a CUDA source-to-source translator using Clang. I followed these instructions: <a href="http://clang.llvm.org/docs/LibASTMatchersTutorial.html" target="_blank">http://clang.llvm.org/docs/LibASTMatchersTutorial.html</a>.</div><div><br></div><div>The built-in tools (like clang-check) work fine on C/C++ programs, but they don't work on CUDA. If I execute the following command (regardless of what <a href="http://kernel.cu" target="_blank">kernel.cu</a> contains) I get the error shown:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace" size="1">$ clang-check <a href="http://kernel.cu" target="_blank">kernel.cu</a> --</font></div></div><div><font face="monospace, monospace" size="1"><br></font></div><div><div><font face="monospace, monospace" size="1">error: unable to handle compilation, expected exactly one compiler job in ' "/usr/local/bin/clang-check" "-cc1" "-triple" "nvptx64-nvidia-cuda" "-aux-triple" "x86_64-unknown-linux-gnu" "-fcuda-target-overloads" "-fcuda-disable-target-call-checks" "-fsyntax-only" "-disable-free" "-main-file-name" "<a href="http://kernel.cu" target="_blank">kernel.cu</a>" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-no-integrated-as" "-mconstructor-aliases" "-fcuda-is-device" "-mlink-cuda-bitcode" "/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc" "-target-feature" "+ptx42" "-target-cpu" "sm_20" "-dwarf-column-info" "-resource-dir" "/usr/local/bin/../lib/clang/3.8.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/local/bin/../lib/clang/3.8.0/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward" "-internal-isystem" "/usr/local/cuda/include" "-include" "__clang_cuda_runtime_wrapper.h" "-fdeprecated-macro" "-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/<path>/test" "-ferror-limit" "19" "-fmessage-length" "192" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "cuda" "/</font><span style="font-family:monospace,monospace;font-size:x-small"><path></span><font face="monospace, monospace" size="1">/test/<a href="http://kernel.cu" target="_blank">kernel.cu</a>";  "/usr/local/bin/clang-check" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-aux-triple" "nvptx64-nvidia-cuda" "-fcuda-target-overloads" "-fcuda-disable-target-call-checks" "-fsyntax-only" "-disable-free" "-main-file-name" "<a href="http://kernel.cu" target="_blank">kernel.cu</a>" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-resource-dir" "/usr/local/bin/../lib/clang/3.8.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/local/bin/../lib/clang/3.8.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/usr/local/cuda/include" "-include" "__clang_cuda_runtime_wrapper.h" "-fdeprecated-macro" "-fdebug-compilation-dir" "/</font><span style="font-family:monospace,monospace;font-size:x-small"><path></span><font face="monospace, monospace" size="1">/test" "-ferror-limit" "19" "-fmessage-length" "192" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "cuda" "/</font><span style="font-family:monospace,monospace;font-size:x-small"><path></span><font face="monospace, monospace" size="1">/test/<a href="http://kernel.cu" target="_blank">kernel.cu</a>"; '</font></div></div><div><div><font face="monospace, monospace" size="1">Error while processing /</font><span style="font-family:monospace,monospace;font-size:x-small"><path></span><font face="monospace, monospace" size="1">/test/<a href="http://kernel.cu" target="_blank">kernel.cu</a>.</font></div></div></blockquote><div><br></div><div>I searched thoroughly online before posting here but could not find relevant answers. Any help would be appreciated.</div><div><br></div><div>Thanks!</div><span class=""><font color="#888888"><div><br></div><div>-Izzat</div><div><br></div></font></span></div>
</div><br></div>