Project

General

Profile

Actions

Bug #7448

closed

MinGW 9.2.1 64bit: Reply.C error: 'gmtime_r' was not declared in this scope

Added by Stefan Bn about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/07/2020
Due date:
% Done:

0%

Estimated time:

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.

Actions #1

Updated by Roel Standaert about 4 years ago

I'll take a look at it. How did you install MinGW? I know of Stephan T. Lavavej's distro and MSYS2.

Actions #2

Updated by Roel Standaert about 4 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.

Actions #3

Updated by Roel Standaert about 4 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.

Actions #4

Updated by Stefan Bn about 4 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:

https://gcc-mcf.lhmouse.com/

Actions #5

Updated by Roel Standaert about 4 years ago

Interesting, that one I didn't know about yet.

Actions #6

Updated by Stefan Bn about 4 years ago

I like it because it already has several libraries built-in, such as boost, zlib etc. This makes building Wt even easier.

Actions #7

Updated by Roel Standaert about 4 years ago

  • Status changed from Resolved to Closed
Actions #8

Updated by Stefan Bn about 4 years ago

I just built 4.2.2 and everything is fine regarding this issue. Thanks for fixing!

Actions

Also available in: Atom PDF