It is not possible to compile CUDA code using nvcc and clang as the host compiler with libc++ as the stdlib.
This is how you can reproduce this issue:
OS: Ubuntu 18.04
- Install cuda 11.2.1 with samples
- Install clang 9 and libc++
a. sudo apt install clang-9 libc+±9-dev libc++abi-9-dev - Replace the Makefile of the 0_Simple/vectorAdd with the one from this post
- Build vectorAdd using the make command
- Result: see code block. This issue is reproducible with newer releases of the CUDA toolkit.
I have also attached a Makefile at the end of this post.
Related post: Cuda issues with Clang Compiler
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9100): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9113): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9121): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9135): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9678): error: namespace "std" has no member "__lazy_enable_if"
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9678): error: expected a ";"
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h(9681): warning: parsing restarts here after previous syntax error
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(375): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(381): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(383): error: cannot overload functions distinguished by return type alone
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(389): error: cannot overload functions distinguished by return type alone