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

Artem Belevich via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 10 15:29:04 PST 2018


It looks like -resource-dir is missing in case of libclang tool.
Try passing -Xclang -resource-dir=/path/to/clang/installation/root

You can get resouce dir with 'clang -print-resource-dir'

--Artem

On Sat, Nov 10, 2018 at 2:25 PM Franklin He <He_Franklin at hotmail.com> wrote:

> 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> 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
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
> --
> --Artem Belevich
>


-- 
--Artem Belevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181110/94d68dba/attachment.html>


More information about the cfe-dev mailing list