pvpgn / pvpgn-server

Next generation of PvPGN server
https://pvpgn.pro
GNU General Public License v2.0
541 stars 155 forks source link

Build fails on Mac OS #450

Closed cen1 closed 3 years ago

cen1 commented 3 years ago

Both gmtime_s() and gmtime_r() are not available

Two problems here

  1. Investigate why cmake does not find the function
    -- Performing Test HAVE_GMTIME_S
    -- Performing Test HAVE_GMTIME_S - Failed
    -- Performing Test HAVE_GMTIME_R
    -- Performing Test HAVE_GMTIME_R - Failed
  2. Fix cmake to fail immediatelly if neither is found.
RElesgoe commented 3 years ago

It’s likely because <time.h> isn’t included. If that’s the case, then I simply made an incorrect assumption that <ctime> will (usually) include <time.h>.

Can you try adding an #include <time.h> at https://github.com/pvpgn/pvpgn-server/blob/develop/ConfigureChecks.cmake#L191

RElesgoe commented 3 years ago

So libstdc++'s <ctime> header does include <time.h>, so gmtime_r() should be in the global namespace.

Why it fails to compile? Still a mystery