-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Different use_constexpr definitions in spdlog and fmt causes compile time error in NVCC (and possibly other compilers) #2856
Comments
PR is welcome. |
Which version of spdlog? |
This is introduced in commit 4f800773 and is included in v1.12.0 and in the current v1.x branch. |
This was referenced Aug 18, 2023
I came across the same issue using nvcc 11.4 and gcc 10.5.0. PR #2859 fixed it for me (spdlog v1.11.0). Thanks @ShujianQian for the PR! |
cartoonist
added a commit
to cartoonist/spdlog
that referenced
this issue
Sep 1, 2023
This was referenced Oct 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When calling
logger.trace()
in an .cu file compiled using nvcc, I get the following compile time error:Cause
The to_string_view utility function is declared as SPDLOG_CONSTEXPR_FUNC. The functions calls fmt::v9::detail::buffer::data() which is declared as FMT_CONSTEXPR. However, FMT_CONSTEXPR has different conditions than SPDLOG_CONSTEXPR_FUNC and is defined to be empty for NVCC, leading to the data() function not declared as constexpr and thus causing the error.
Fix
Adding the same condition to the definition of SPDLOG_CONSTEXPR_FUNC fixes the error. However, the two definitions need to be kept in sync in future changes.
Another potential fix is to declare the to_string_view functions as inline instead of constexpr.
The text was updated successfully, but these errors were encountered: