[botan-devel] Error During make (can't build Botan)

Jack Lloyd lloyd at randombit.net
Fri Dec 2 09:24:08 EST 2011


On Fri, Dec 02, 2011 at 09:14:43AM -0500, Brad Tilley wrote:

> Thank you. I applied the patch. The reinterpret_cast fixed it. make gets
> father along now, but fails here:
> 
> src\utils\time.cpp: In function 'tm Botan::<unnamed>::do_gmtime(time_t)':
> src\utils\time.cpp:55:27: error: 'gmtime_s' was not declared in this scope
> make: *** [build\lib\utils_time.obj] Error 1

As is might be obvious by now, GCC on Windows isn't a well tested build.
Can you try the attached patch?

-Jack
-------------- next part --------------
#
# old_revision [880033c04ee7614e8128908b200d4146588c4dd9]
#
# patch "src/utils/time.cpp"
#  from [7a742e859567cb9d0857cbe8d29fc9adc46535f2]
#    to [b69259ee9ad09116ba545f03b406fb725873caf7]
#
============================================================
--- src/utils/time.cpp	7a742e859567cb9d0857cbe8d29fc9adc46535f2
+++ src/utils/time.cpp	b69259ee9ad09116ba545f03b406fb725873caf7
@@ -7,16 +7,7 @@
 
 #include <botan/time.h>
 #include <botan/exceptn.h>
-#include <ctime>
 
-#if defined(BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME)
-  #include <windows.h>
-#endif
-
-#if defined(BOTAN_TARGET_OS_HAS_GETTIMEOFDAY)
-  #include <sys/time.h>
-#endif
-
 #if defined(BOTAN_TARGET_OS_HAS_CLOCK_GETTIME)
 
   #ifndef _POSIX_C_SOURCE
@@ -29,8 +20,23 @@
     #define CLOCK_REALTIME 0
   #endif
 
+#elif defined(BOTAN_TARGET_OS_HAS_GMTIME_S) || \
+      defined(BOTAN_TARGET_OS_HAS_GMTIME_R)
+
+  #include <time.h>
+
 #endif
 
+#include <ctime>
+
+#if defined(BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME)
+  #include <windows.h>
+#endif
+
+#if defined(BOTAN_TARGET_OS_HAS_GETTIMEOFDAY)
+  #include <sys/time.h>
+#endif
+
 namespace Botan {
 
 namespace {
@@ -52,9 +58,9 @@ std::tm do_gmtime(time_t time_val)
    std::tm tm;
 
 #if defined(BOTAN_TARGET_OS_HAS_GMTIME_S)
-   gmtime_s(&tm, &time_val); // Windows
+   ::gmtime_s(&tm, &time_val); // Windows
 #elif defined(BOTAN_TARGET_OS_HAS_GMTIME_R)
-   gmtime_r(&time_val, &tm); // Unix/SUSv2
+   ::gmtime_r(&time_val, &tm); // Unix/SUSv2
 #else
    std::tm* tm_p = std::gmtime(&time_val);
    if (tm_p == 0)


More information about the botan-devel mailing list