-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Remove incorrect forward-declaration of lgamma_r header #80979
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
libc++ declares `lgamma_r` as: ``` extern "C" double lgamma_r(double, int *); ``` while modern glibc uses the following: ``` __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); ``` This causes (I did not digged to the very bottom of it) the following compilation error when compiling with nvcc: ``` libcxx/include/__random/binomial_distribution.h(117): error: linkage specification is incompatible with previous "lgamma_r" /usr/include/x86_64-linux-gnu/bits/mathcalls.h(271): here ```
|
@llvm/pr-subscribers-libcxx Author: Yuriy Chernyshov (georgthegreat) Changeslibc++ declares while modern glibc uses the following: This causes (I did not digged to the very bottom of it) the following compilation error when compiling with nvcc: Full diff: https://github.com/llvm/llvm-project/pull/80979.diff 1 Files Affected:
diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h
index e8774bb8d67ee..54f321af63d50 100644
--- a/libcxx/include/__random/binomial_distribution.h
+++ b/libcxx/include/__random/binomial_distribution.h
@@ -97,10 +97,6 @@ class _LIBCPP_TEMPLATE_VIS binomial_distribution {
}
};
-#ifndef _LIBCPP_MSVCRT_LIKE
-extern "C" double lgamma_r(double, int*);
-#endif
-
inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
#if defined(_LIBCPP_MSVCRT_LIKE)
return lgamma(__d);
|
|
This error is triggered upon #including |
e1a3db8 to
af4e771
Compare
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
This backports [PR #80979](llvm/llvm-project#80979) from llvm upstream.
This backports [PR #80979](llvm/llvm-project#80979) from llvm upstream.
This backports [PR #80979](llvm/llvm-project#80979) from llvm upstream.
af4e771 to
e7be921
Compare
This backports [PR #80979](llvm/llvm-project#80979) from llvm upstream.
This backports [PR #80979](llvm/llvm-project#80979) from llvm upstream.
This backports [PR #80979](llvm/llvm-project#80979) from llvm upstream.
|
This fails on the Apple CI with: |
|
We have this patch ported locally and it works just fine (though our CI tests against There is no cuda compiler under MacOS, so we may simply forward-declare it under |
|
This seems to break when we use modules (see the CI job). |
|
Unfortunately, I have no experience with modules and can not quite understand the reason for hte failure. |
|
Could you rebase this on top of latest main so we can have a look at the modules issues if they still exist? |
libc++ declares
lgamma_ras:while modern glibc uses the following:
This causes (I did not digged to the very bottom of it) the following compilation error when compiling with nvcc:
Using original declaration solves the issue.