aboutsummaryrefslogtreecommitdiff
path: root/src/util/url.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-04-02 12:46:03 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-04-02 12:47:13 +0200
commit5c1ba3a10a18c6edee20f27f3609ffbbbaa2e8f3 (patch)
treec73218fdc972628f7fbba821de162267bed6af86 /src/util/url.h
parent41fa2926d86a57c9623d34debef20746ee2f454a (diff)
parenta46484c8b3715725f5dc0b8ad1bf921880ed9af1 (diff)
Merge #18358: util: fix compilation with mingw-w64 7.0.0
a46484c8b3715725f5dc0b8ad1bf921880ed9af1 build: Detect gmtime_* definitions via configure (Ben Woosley) Pull request description: Something has changed in the mingw-w64 headers such that we no-longer compile when using 7.0.0. ```bash util/time.cpp: In function 'std::__cxx11::string FormatISO8601DateTime(int64_t)': util/time.cpp:84:9: error: 'gmtime_r' was not declared in this scope if (gmtime_r(&time_val, &ts) == nullptr) { ^~~~~~~~ util/time.cpp: In function 'std::__cxx11::string FormatISO8601Date(int64_t)': util/time.cpp:97:9: error: 'gmtime_r' was not declared in this scope if (gmtime_r(&time_val, &ts) == nullptr) { ``` Looking at time.h, it seems that `gmtime_r()` is only available when `_POSIX_C_SOURCE` is defined. This must have been the case for 6.0.0 (which we compile fine using), but no-longer seems to be for 7.0.0? I've checked that adding `-D_POSIX_C_SOURCE=200112L` to our compile flags does fix the issue above. However, an alternative solution seems to be to just use `gmtime_s()` instead, when compiling with `mingw-w64`, as `gmtime_r()` [just wraps `gmtime_s()` anyways](https://github.com/mirror/mingw-w64/blob/7c03b11bf173944679102bbe0ac061842e2f594b/mingw-w64-headers/crt/time.h#L284). I've tested this change crosss-compiling on Debian Bullseye ([mingw-w64 7.0.0](https://packages.debian.org/source/bullseye/mingw-w64)) and Buster ([mingw-w64 6.0.0](https://packages.debian.org/source/buster/mingw-w64)). ACKs for top commit: laanwj: ACK a46484c8b3715725f5dc0b8ad1bf921880ed9af1 Tree-SHA512: 7cf1a81060b9625d64de40b77341d74704cc8ae1358d25d7e2909685dc83a7a9762260d72e47806e9f0a5cbabf88d0239ec9e0fd0ebd3731b1d206b075f43a63
Diffstat (limited to 'src/util/url.h')
0 files changed, 0 insertions, 0 deletions