Vanilla-Conquer icon indicating copy to clipboard operation
Vanilla-Conquer copied to clipboard

Build issue on OpenBSD 7.3

Open extrowerk opened this issue 1 year ago • 2 comments

~/K/V/b > cmake ..
CMake Warning at cmake/ClangFormat.cmake:3 (message):
  clang-format 13.0.0 is older than 14.0.0, formatting may yield unexpected
  results
Call Stack (most recent call first):
  CMakeLists.txt:119 (include)


-- Could NOT find ImageMagick (missing: ImageMagick_convert_EXECUTABLE ImageMagick_convert_EXECUTABLE)
CMake Warning at cmake/BuildIcons.cmake:24 (message):
  ImageMagick was not found, icons will not be generated.
Call Stack (most recent call first):
  tiberiandawn/CMakeLists.txt:199 (make_icon)


-- Could NOT find ImageMagick (missing: ImageMagick_convert_EXECUTABLE ImageMagick_convert_EXECUTABLE)
CMake Warning at cmake/BuildIcons.cmake:24 (message):
  ImageMagick was not found, icons will not be generated.
Call Stack (most recent call first):
  redalert/CMakeLists.txt:223 (make_icon)


-- Enabled features:
 * SDL2, SDL2 video backend
 * VanillaTD, Tiberian Dawn executable
 * VanillaRA, Red Alert executable
 * Networking, Networking support

-- Disabled features:
 * SDL1, SDL1 video backend
 * RemasterTD, Remastered Tiberian Dawn dll
 * RemasterRA, Remastered Red Alert dll
 * MapEditorTD, Include internal scenario editor in VanillaTD
 * MapEditorRA, Include internal scenario editor in VanillaRA
 * Tests, Unit tests
 * Tools, Mod developer tools

-- Configuring done
-- Generating done
-- Build files have been written to: /home/szilard/Kod/Vanilla-Conquer/b
~/K/V/b > make -j 4
[  0%] Checking the git repository for changes...
[  0%] Built target check_git
[  0%] Building CXX object common/CMakeFiles/common.dir/connect.cpp.o
[  0%] Building CXX object common/CMakeFiles/common.dir/ccfile.cpp.o
/home/szilard/Kod/Vanilla-Conquer/common/connect.cpp:47:10: fatal error: 'sys/timeb.h' file not found
#include <sys/timeb.h>
         ^~~~~~~~~~~~~
[  0%] Building CXX object common/CMakeFiles/common.dir/cdfile.cpp.o
1 error generated.
*** Error 1 in target 'common/CMakeFiles/common.dir/connect.cpp.o'
[  1%] Building CXX object common/CMakeFiles/common.dir/cliprect.cpp.o
*** Error 1 in . (common/CMakeFiles/common.dir/build.make:384 'common/CMakeFiles/common.dir/connect.cpp.o': cd /home/szilard/Kod/Vanilla-Con...)
*** Error 2 in . (CMakeFiles/Makefile2:209 'common/CMakeFiles/common.dir/all')
*** Error 2 in /home/szilard/Kod/Vanilla-Conquer/b (Makefile:91 'all': make -s -f CMakeFiles/Makefile2 all)
~/K/V/b > uname -srm
OpenBSD 7.3 amd64

extrowerk avatar May 24 '23 19:05 extrowerk

Thank you for the report, unforunately no one uses OpenBSD of those who regularly work with the code so it might be some time before a fix for this is done.

OmniBlade avatar May 25 '23 15:05 OmniBlade

ftime(3) is historical interface and is usually obsoleted by gettimeofday(2) on modern systems, maybe OpenBSD removed it completely. Consider the following pseudo-patch (comments and typecasts removed for brevity):

--- common/connect.cpp.orig
+++ common/connect.cpp
@@ -44,7 +44,7 @@
 
 #include <stdio.h>
 //#include <mem.h>
-#include <sys/timeb.h>
+#include <sys/time.h>
 #include <string.h>
 #include "connect.h"
 
@@ -745,7 +745,7 @@ int ConnectionClass::Service_Receive_Queue(void)
  *=========================================================================*/
 unsigned int ConnectionClass::Time(void)
 {
-    static struct timeb mytime;
+    static struct timeval mytime;
     unsigned int msec;
 
 #ifdef WWLIB32_H
@@ -773,8 +773,8 @@ unsigned int ConnectionClass::Time(void)
     /*------------------------------------------------------------------------
     If the Westwood library isn't being used, use the DOS timer.
     ------------------------------------------------------------------------*/
-    ftime(&mytime);
-    msec = mytime.time * 1000 + mytime.millitm;
+    gettimeofday(&mytime, NULL);
+    msec = mytime.tv_sec * 1000 + mytime.tv_usec / 1000;
     return ((msec / 100) * 6);
 
 #endif

danfe avatar Nov 02 '23 03:11 danfe