Bug #7448
closedMinGW 9.2.1 64bit: Reply.C error: 'gmtime_r' was not declared in this scope
0%
Description
Compiling Wt 4.2.x with MinGW 9.2.1 64 bit on Windows 10 fails here:
D:\Dev\BuildLibs\wt\wt-4.2.1\src\http\Reply.C: In function 'void http::server::httpDateBuf(time_t, Wt::WStringStream&)':
D:\Dev\BuildLibs\wt\wt-4.2.1\src\http\Reply.C:74:3: error: 'gmtime_r' was not declared in this scope; did you mean 'gmtime_s'?
74 | gmtime_r(&t, &td);
| ^~~~~~~~
| gmtime_s
mingw32-make[2]: *** [src\http\CMakeFiles\wthttp.dir\build.make:161: src/http/CMakeFiles/wthttp.dir/Reply.C.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:568: src/http/CMakeFiles/wthttp.dir/all] Error 2
mingw32-make: *** [Makefile:129: all] Error 2
This issue can be fixed when commenting out #ifndef _MINGW32 and the corresponding #endif
in gmtime_r section of src/http/Reply.C
This code used to run using earlier MinGW versions and I'm not sure about the consequences of the above fix.
However, I did (painfully) learn about so many issues with MinGW versions <9 (std::any and non-deterministic random number generation leading to hash-token collisions) that it is not really advisible to use MinGW prior version 9 anymore.
Updated by Roel Standaert almost 5 years ago
I'll take a look at it. How did you install MinGW? I know of Stephan T. Lavavej's distro and MSYS2.
Updated by Roel Standaert almost 5 years ago
I have managed to get that error, so I don't strictly need you to reply anymore, but I'm always curious to hear it.
Updated by Roel Standaert almost 5 years ago
- Status changed from New to Resolved
I just changed it to use gmtime_s
if on Windows, regardless of if we're using MinGW. I think that should be universally available nowadays. I pushed the change to wt3
and master
.
Updated by Stefan Bn almost 5 years ago
Roel Standaert wrote:
How did you install MinGW?
I use the MinGW distribution that is referenced here in the Notes section:
https://en.cppreference.com/w/cpp/numeric/random/random_device
that leads to MinGW downloads here:
Updated by Roel Standaert almost 5 years ago
Interesting, that one I didn't know about yet.
Updated by Stefan Bn almost 5 years ago
I like it because it already has several libraries built-in, such as boost, zlib etc. This makes building Wt even easier.
Updated by Roel Standaert almost 5 years ago
- Status changed from Resolved to Closed
Updated by Stefan Bn almost 5 years ago
I just built 4.2.2 and everything is fine regarding this issue. Thanks for fixing!