Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I use CMake 3.18 with CLion 2020.2.5 and want to use Clang as CUDA compiler. I do with this with the following two lines at the top of my
CMakeLists.txt
:
set(CMAKE_CUDA_COMPILER_ID Clang)
set(CMAKE_CUDA_COMPILER ${CMAKE_CXX_COMPILER})
And it works very well for the code, and I also CLion seems to be able to work with the code just fine. But it still complains while configuring the project:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mu/project
Problems were encountered while collecting compiler information:
Unexpected compiler output. This compiler might be unsupported.
If you are using GCC/Clang, please report the bug in https://youtrack.jetbrains.com/issues/CPP.
In the error log I find this:
Checking whether the CUDA compiler is NVIDIA using "" did not match "nvcc: NVIDIA \(R\) Cuda compiler driver":
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
In the output log it seems that it can identify the compiler just fine:
Checking whether the CUDA compiler is Clang using "" matched "(clang version)":
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" succeeded.
Compiler: /usr/bin/clang++
Build flags:
Id flags: --cuda-path=/usr/local/cuda;--cuda-gpu-arch=sm_52 -v
The output was:
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version 10.0
"/usr/bin/clang-11" -cc1 -triple nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCUDACompilerId.cu -mrelocation-model static -mframe-pointer=all -fno-rounding-math -fno-verbose-asm -no-integrated-as -munwind-tables -aux-target-cpu x86-64 -fcuda-is-device -mlink-builtin-bitcode /usr/local/cuda/nvvm/libdevice/libdevice.10.bc -target-feature +ptx63 -target-sdk-version=10.0 -target-cpu sm_52 -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/11.0.0 -internal-isystem /usr/lib64/clang/11.0.0/include/cuda_wrappers -internal-isystem /usr/local/cuda/include -include __clang_cuda_runtime_wrapper.h -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fno-dwarf-directory-asm -fno-autolink -fdebug-compilation-dir /home/mu/project/CMakeFiles/3.18.4/CompilerIdCUDA -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -o /tmp/CMakeCUDACompilerId-b39068.s -x cuda CMakeCUDACompilerId.cu
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/lib64/clang/11.0.0/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib64/clang/11.0.0/include/cuda_wrappers
/usr/local/cuda/include
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward
/usr/local/include
/usr/lib64/clang/11.0.0/include
/usr/include
End of search list.
"/usr/local/cuda/bin/ptxas" -m64 -O0 -v --gpu-name sm_52 --output-file /tmp/CMakeCUDACompilerId-0e6743.o /tmp/CMakeCUDACompilerId-b39068.s
ptxas info : 0 bytes gmem
"/usr/local/cuda/bin/fatbinary" --cuda -64 --create /tmp/CMakeCUDACompilerId-346390.fatbin --image=profile=sm_52,file=/tmp/CMakeCUDACompilerId-0e6743.o --image=profile=compute_52,file=/tmp/CMakeCUDACompilerId-b39068.s
"/usr/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu -target-sdk-version=10.0 -aux-triple nvptx64-nvidia-cuda -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCUDACompilerId.cu -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/11.0.0 -internal-isystem /usr/lib64/clang/11.0.0/include/cuda_wrappers -internal-isystem /usr/local/cuda/include -include __clang_cuda_runtime_wrapper.h -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/mu/project/CMakeFiles/3.18.4/CompilerIdCUDA -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcuda-include-gpubinary /tmp/CMakeCUDACompilerId-346390.fatbin -faddrsig -o /tmp/CMakeCUDACompilerId-4af90f.o -x cuda CMakeCUDACompilerId.cu
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/lib64/clang/11.0.0/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib64/clang/11.0.0/include/cuda_wrappers
/usr/local/cuda/include
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward
/usr/local/include
/usr/lib64/clang/11.0.0/include
/usr/include
End of search list.
"/usr/bin/ld" --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/10/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/10 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/CMakeCUDACompilerId-4af90f.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/10/crtend.o /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crtn.o
Compilation of the CUDA compiler identification source "CMakeCUDACompilerId.cu" produced "a.out"
The CUDA compiler identification is Clang, found in "/home/mu/project/CMakeFiles/3.18.4/CompilerIdCUDA/a.out"
How can I resolve with issue between CMake and CLion?
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.