google / cctz

CCTZ is a C++ library for translating between absolute and civil times using the rules of a time zone.
Apache License 2.0
597 stars 166 forks source link

[Bug]: time_zone_format.cc causes compilation issues under QNX #265

Closed xzxzzxzxzca closed 1 year ago

xzxzzxzxzca commented 1 year ago

Source file src/time_zone_format.cc does #define _XOPEN_SOURCE in order to use strptime. However, on QNX (at least v 7.1) in <sys/platform.h> the definition isn't merely checked for presence, but is value-tested. It understands values 500, 600, and 700, and otherwise will bail out with #error This version of XOPEN_SOURCE is not supported.

The header is included like this (please note that I'm using cctz as part of abseil library, hence the paths):

In file included from .../qnx7/usr/include/limits.h:29,
                 from .../qnx7/usr/include/c++/v1/limits.h:58,
                 from external/com_google_absl/absl/base/config.h:52,
                 from external/com_google_absl/absl/time/internal/cctz/src/time_zone_format.cc:27:

I think it should be something like #define _XOPEN_SOURCE 500 (at least this works fine for me), or at least so under #if defined(__QNX__).

devbww commented 1 year ago

It will take a little while for this to percolate up to Abseil.