https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/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. >From cf2586ab3a6afde64b4e9eeb1016a62e28c81cce Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" <yaxun....@amd.com> Date: Wed, 8 Jan 2025 13:57:50 -0500 Subject: [PATCH] [CUDA][HIP] improve error message for missing cmath 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. --- clang/lib/Headers/cuda_wrappers/cmath | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/Headers/cuda_wrappers/cmath b/clang/lib/Headers/cuda_wrappers/cmath index 45f89beec9b4df..7deca678bf252e 100644 --- a/clang/lib/Headers/cuda_wrappers/cmath +++ b/clang/lib/Headers/cuda_wrappers/cmath @@ -24,7 +24,11 @@ #ifndef __CLANG_CUDA_WRAPPERS_CMATH #define __CLANG_CUDA_WRAPPERS_CMATH +#if __has_include_next(<cmath>) #include_next <cmath> +#else +#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." +#endif #if defined(_LIBCPP_STD_VER) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits