[cfe-dev] libtooling/libclang cannot find "__clang_cuda_runtime_wrapper.h"

Franklin He via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 10 14:25:01 PST 2018


I did some more testing and the problem does not occur if I put the libTooling-based executable in the $LLVM_INSTALL_DIR/bin directory. I originally did an out of source build which would have put the executable not in tree with the rest of the LLVM library.
The libclang-based tool still exhibit the same issue no matter where I put the final executable.

I've attached the terminal output using the -v flag with tools I've made using libtooling, libclang, and also the output if I compile a test CUDA file using Clang. For some reason they all check different include directories.....

I've also attached what would happen if you force the include of the CUDA wrappers using the -I flag, in short: A lot of weird errors.

-- Franklin

________________________________
From: Artem Belevich <tra at google.com>
Sent: Thursday, 8 November 2018 12:19 PM
To: He_Franklin at hotmail.com
Cc: cfe-dev
Subject: Re: [cfe-dev] libtooling/libclang cannot find "__clang_cuda_runtime_wrapper.h"

It would help a lot if you could figure out what compiler options we end up using when the file is handled by libtooling or libclang. The fact that you've got the error means that the file *is* treated as a CUDA file (good news) but we either didn't add include path to clang headers, or the headers are not where they should be.

I don't know if there's an easy way to do it libtooling or libclang. In the past I dug these options out with debugger. You can try passing '-v' and see if you get back the usual printout of header search path.

--Artem

On Sun, Oct 14, 2018 at 2:13 AM Franklin He via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:

Hello

I am attempting to write a static analyzer for CUDA using the Clang infrastructure.

After writing a simple tool, and giving it the example CUDA file in https://llvm.org/docs/CompileCudaWithLLVM.html , I get the following error:

fatal error: '__clang_cuda_runtime_wrapper.h' file not found

so far this happens with both libtooling and libclang. I have tried using clang to compile the same CUDA file and it works.
I am currently linking against clang sources from the trunk, but this also happens with Clang version 6.
I currently have CUDA 10 installed on this computer.

Any help would be appreciated.

Regards
Franklin
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


--
--Artem Belevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181110/6d2a269d/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libtooling_log.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181110/6d2a269d/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libclang_log.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181110/6d2a269d/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: clang_log.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181110/6d2a269d/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libclang_include_clang_directory_log.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181110/6d2a269d/attachment-0003.txt>


More information about the cfe-dev mailing list