-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[CUDA][HIP] improve error message for missing cmath #122155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-clang Author: Yaxun (Sam) Liu (yxsamliu) ChangesOne 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. Full diff: https://github.com/llvm/llvm-project/pull/122155.diff 1 Files Affected:
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)
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/24/builds/4013 Here is the relevant piece of the build log for the reference |
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.