Skip to content

Commit 465a3ce

Browse files
authored
[CUDA][HIP] improve error message for missing cmath (#122155)
One common error seen in CUDA/HIP compilation is: fatal error: 'cmath' file not found which is due to inproper installation of standard C++ libraries. Since it happens with #include_next, users may feel confusing which cmath is not found and how to fix it. Add an error directive to help users resolve this issue.
1 parent dfa5ee2 commit 465a3ce

File tree

1 file changed

+4
-0
lines changed
  • clang/lib/Headers/cuda_wrappers

1 file changed

+4
-0
lines changed

clang/lib/Headers/cuda_wrappers/cmath

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
#ifndef __CLANG_CUDA_WRAPPERS_CMATH
2525
#define __CLANG_CUDA_WRAPPERS_CMATH
2626

27+
#if __has_include_next(<cmath>)
2728
#include_next <cmath>
29+
#else
30+
#error "Could not find standard C++ header 'cmath'. Add -v to your compilation command to check the include paths being searched. You may need to install the appropriate standard C++ library package corresponding to the search path."
31+
#endif
2832

2933
#if defined(_LIBCPP_STD_VER)
3034

0 commit comments

Comments
 (0)