Clang12 is not able to compile a simple test program with CUDA11.4.3 on Ubuntu20.04.3 LTS on WSL

I’m trying to build my C++ CMake project using Clang-12 instead of GCC-10 but compilation breaks on the stage of trying to compile simple program with error

Building CUDA object CMakeFiles/cmTC_101e9.dir/main.cu.o
    /usr/local/cuda-11.4//bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/bin/clang++-12   -std=c++17 -MD -MT CMakeFiles/cmTC_101e9.dir/main.cu.o -MF CMakeFiles/cmTC_101e9.dir/main.cu.o.d -x cu -c /path_to_my_proj/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_101e9.dir/main.cu.o
    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(70): error: qualified name is not allowed

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(72): error: expected a "("

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(72): error: expected a type specifier

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(72): error: expected a ")"

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(76): error: expected a "("

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(76): error: expected a type specifier

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(77): error: expected a ";"

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(78): error: expected a "("

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(78): error: expected a ";"

    /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/numeric_traits.h(88): error: class template "__gnu_cxx::__numeric_traits_integer<_Value>" has no member "__is_signed"

    10 errors detected in the compilation of "/path_to_my_proj/CMakeFiles/CMakeTmp/main.cu".

I am using CUDA 11.4.3 on Ubuntu 20.04.3 LTS on WSL. I saw in documentation Installation Guide Linux :: CUDA Toolkit Documentation that Clang 12 is a supported compiler for this version of Ubuntu. Can you help me, please, to fix my build with Clang12?

1 Like

Thank you for bringing this to our attention.

Please follow the instructions here to file a bug report against NVCC.

Please include all verbose output and intermediate files, generated by adding ‘-v -keep’ to the nvcc command line, in your bug report.