[cfe-users] Usage of CLang CUDA target with MinGW stdlib

Artem Belevich via cfe-users cfe-users at lists.llvm.org
Fri Nov 9 10:38:24 PST 2018


+cc cfe-users back;

On Thu, Nov 8, 2018 at 10:20 PM KOLANICH <kolan_n at mail.ru> wrote:

> 2018 11 7 23:25:38 UTC, Artem Belevich <tra at google.com> пишет:
> >This may be same/similar to https://bugs.llvm.org/show_bug.cgi?id=38811
> >
> >Basically, there's no owner for CUDA support on windows. Someone needs
> >to
> >figure out why/how CUDA includes behave differently under mingw and
> >figure
> >out how to work around that in the CUDA wrapper headers in clang.
> >
> >
> >On Fri, Nov 2, 2018 at 2:23 PM KOLANICH via cfe-users <
> >cfe-users at lists.llvm.org> wrote:
> >
> >> Hello everybody.
> >>
> >> Could anyone clarify how to use this cuda target (-std=c++11 -x cuda)
> >with
> >> MinGW stdlib?
> >>
> >> I mean I get errors
> >>
> >>
>
> ><censored2>\LLVM-7.0.0-win32\lib\clang\7.0.0\include\cuda_wrappers\new:41:12:
> >> error: use of undeclared identifier 'malloc' return ::malloc(size);
> >>
>
> ><censored2>\LLVM-7.0.0-win32\lib\clang\7.0.0\include\cuda_wrappers\new:58:7:
> >> error: no type named 'free' in the global namespace ::free(ptr);
> >>
> >> and I wonder what I should do to fix them.
> >> _______________________________________________
> >> cfe-users mailing list
> >> cfe-users at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
> >>
>
> Thank you for the suggestion. But this doesn't clarify the strange syntax
> used in the mentioned lines.


You need to look at the preprocessed output in order to see what is it that
clang is complaining about.


> I googled a bit and haven't found anything clarifying, but there are some
> hints suggesting that it may be specific to Visual Studio.
>

It's quite likely. Clang's wrappers for C++ standard library are fairly
specific to particular library. AFAICT we never even tried to make it work
with whatever VC uses.


>
> P.S. I don't use CUDA headers

You actually do. With  "-x cuda" clang pre-includes ton of CUDA headers
(same as nvcc) and adds extra include search paths.
If you do not want to pre-include any CUDA headers, then you need to pass
-nocudainc option.



> - I have AMD GPU and there is a CUDA impl for any OpenCL-capable device
> having own headers, which may be far more compatible that the ones provided
> by CUDA.


Interesting. Can you tell me more about this CUDA-over-OpenCL project?


> The problem I encounter in the headers shipped with CLang, it seems they
> depend on something missing in MinGW headers.
>

Those headers are only intended to make clang work with NVIDIA's CUDA SDK
on linux. MinGW + a project that provides alternative CUDA headers is
unlikely to work as is. -nocudainc should get clang's headers out of your
way, but it will be up to you to provide the equivalent.

Good luck,
-- 
--Artem Belevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20181109/f7ae67bc/attachment.html>


More information about the cfe-users mailing list