-
Notifications
You must be signed in to change notification settings - Fork 15.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
Problem compiling upb (NAN is no longer compile-time constant in Windows 11 SDK 10.0.26100.0) #17308
Comments
What an annoying thing for them to change. We probably won't be able to give this any cycles until next week. Thank you for bringing it to our attention. |
@CaeruleusAqua I see that you're installing upb directly via vcpkg vs using upb via protobuf. I don't think we really intended for upb to be offered as a stand-alone package yet (we don't release this ourselves), so interested in understanding what your use case is! AFAICT from https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907?pageSize=15&sort=active&topics=cppcompiler&q=__ucrt_int_to_float, it sounds like this might be the result of a bug in windows 11? @haberman thoughts on whether this makes sense to work around, or perhaps just wait for a fix there. |
I don't use upb at all, it is included as a dependency in vcpkg, which may not be necessary. That doesn't change the fact that upb doesn't compile with the current development kit, I also think that the problem lies with Microsoft. But nobody here can say whether they will fix it, in any case several projects will probably run into the problem soon. Whether there is a workaround or fix for this would have to be decided by you guys ;-) |
is it related to #17238 ? |
Does it help to change |
Fixes: #17308, #17238 Confirmation that this addresses the issue: grpc/grpc#37210 (comment) PiperOrigin-RevId: 652525912
It seems that in some cases MSVC doesn't accept |
We test against the versions of MSVC that we support, and the tests passed with this fix. |
Fixes: #17308, #17238 Confirmation that this addresses the issue: grpc/grpc#37210 (comment) PiperOrigin-RevId: 652541857
* Fixed `NAN`/`INFINITY` definitions to work on Windows 11 SDK. Fixes: #17308, #17238 Confirmation that this addresses the issue: grpc/grpc#37210 (comment) PiperOrigin-RevId: 652541857 * Fix compilation in Clang C23 mode. In C23, `false` is now of type `bool`, not `int`. This turned a couple places where `false` was returned instead of `NULL` into errors. The workaround in upb for Windows's broken NAN macro causes an error in Clang under C23, `cannot compile this static initializer yet`, I believe because `0.0 / 0.0` is not valid in constant-evaluation. This seems like it's probably a legitimate result of C23 standardizing constexpr, although it _could_ be a clang bug. In any case, refine the workaround a bit, to avoid this problem. I've also reverted the kUpb_FltInfinity/kUpb_Infinity back to their former definitions, as INFINITY wasn't broken by the windows header, only NAN. PiperOrigin-RevId: 683152452 * Fix const INFINITY issue on MSVC. We previously hit this for NAN, but it appears the latest version of MSVC used in windows github runners has the same issue for INFINITY. The same strategy can be applied here. This will be backported to fix broken release branches. PiperOrigin-RevId: 699390594 * Regenerate stale files * Update GitHub Actions to use macOS-13 ahead of macOS-12 deprecation. See actions/runner-images#10721. PiperOrigin-RevId: 684546079 * Pin to python 3.12 in upb/macos tests. Python 3.13 seems to have some issues with our dependencies and both numpy and setuptools fails to install. PiperOrigin-RevId: 689955916 * Fix bad cherry-pick --------- Co-authored-by: Joshua Haberman <haberman@google.com> Co-authored-by: Protobuf Team Bot <protobuf-github-bot@google.com>
What version of protobuf and what language are you using?
upb Version 4.25.1 (from vcpkg) look at my issue there:
microsoft/vcpkg#39626
Windows 11
Compiler: MSVC 19.40.33811.0
What did you do?
Steps to reproduce the behavior:
See log:
C:\vcpkg\buildtrees\upb\install-x64-windows-dbg-out.log
The line 20 in message.c says:
const double kUpb_NaN = NAN;
the preprocessor turns it into:
const double kUpb_NaN = (__ucrt_int_to_float(0x7FC00000));
If I google
__ucrt_int_to_float
I get the following issue which describes the problem:https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907?pageSize=15&sort=active&topics=cppcompiler&q=__ucrt_int_to_float
The text was updated successfully, but these errors were encountered: