-
Notifications
You must be signed in to change notification settings - Fork 90
[Utils] Use gmtime_s with _WIN32 #914
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
@codeofalltrades had mentioned to make this change to support windows as well. I was encountering this issue and lazily just defaulted to gmtime_s, but this is a much better approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran a test with changing Github Actions to use Ubuntu 20. This does solve the Win64 issue with ubuntu 20; but the same problem exists for Win32; So it looks like it needs one more conditional on that # if.
See here:
https://github.com/CaveSpectre11/veil/runs/2274102054?check_suite_focus=true
This allows the project to build in WSL/Ubuntu 20.04 x64 and potentially other Windows versions.
e1b5e3c
to
aa7e26e
Compare
According to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK aa7e26e
https://github.com/CaveSpectre11/veil/actions/runs/736392142 (Ubuntu 20 actions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK aa7e26e
Ack aa7e26e |
Problem
Following the build instructions for WSL with Ubuntu 20.04 resulted in this error:
Manually changing
gmtime_r
togmtime_s
results in a further warning because the arguments are reversed, a sign that we're building with the Windows version that the code uses when_MSC_VER
is set.Root Cause
WSL with Ubuntu 20.04 is not building with msvc but with mingw.
Solution
Use the Windows version of this code when either
_MSC_VER
or__MINGW64__
is set.(Note: I also needed to change the build command
make HOST=x86_64-w64-mingw32
toCC_FOR_BUILD=x86_64-linux-gnu-gcc make HOST=x86_64-w64-mingw32
in order to build gmp, but I was not sure if I should update the docs.)Bounty PR
None
Bounty Payment Address
sv1qqpswvjy7s9yrpcmrt3fu0kd8rutrdlq675ntyjxjzn09f965z9dutqpqgg85esvg8mhmyka5kq5vae0qnuw4428vs9d2gu4nz643jv5a72wkqqq73mnxr
Unit Testing Results
Tested on win64 mingw WSL/Ubuntu 20.04 by building successfully and running unittests successfully compared to master.