Building ioquake3 using MinGW on Windows 7 fails

Hi

I cloned your Git repo and attempted to build the engine usingMinGW, following your slightly outdated tutorial on the Wiki. I entered the root ioq3 directory using a MinGw Shell and entered make. Everything went smoothly for a while, then I got this error:

LD build/release-mingw32-x86/openarena.x86.exe
code/libs/win32/libcurl.a(strequal.o):strequal.c:(.text+0x14): undefined reference to 'strcasecmp'
code/libs/win32/libcurl.a(strequal.o):strequal.c:(.text+0x48): undefined reference to 'strncasecmp'
collect2.exe: error: ld returned 1 exit status

Awesome… The user Hitchhiker mentioned in this OpenArena forum post that it is a compliance issue with the latest version of GCC, and that I should use GCC v.4.6.3 instead. I honestly consider it a bad solution, so I decided to upgrade cURL in the engine instead to version 7.34.0 (released December 17, 2013). I made sure to build it as small as possible with HTTP and FTP support only. This resolved the issue and compilation seemed to run well until the compilation of the user interface:

UI_CC code/q3_ui/ui_main.c
<command-line>:0:4: error: expected identifier or '(' before numeric constant
code/q3_ui/../qcommon/q_shared.h:190:15: note: in expansion of macro 'ui'
  unsigned int ui;
               ^
In file included from code/q3_ui/ui_local.h:26:0,
                 from code/q3_ui/ui_main.c:32:
code/q3_ui/../qcommon/q_shared.h:191:1: warning: no semicolon at end of struct o
r union [enabled by default]
 } floatint_t;
 ^

For some reason, it doesn’t like this union definition in qcommon/q_shared.h:

typedef union {
    float f;
    int i;
    unsigned int ui;
} floatint_t;

I tried varius variations of this declaration without any success. I even built a small test program utilizing the union which compiled and ran successfully using GCC. I Googled the issue and learned that anotherone have had the same issue as me. Their solution was however that this was QVM specific and that they could avoid it by compiling the engine only - yet again not a good solution in my opinion.

I have so far failed to find a good solution, any suggestions and/or help is much appreciated.

Most probably your compiler defines “ui” as “unsigned int” somewhere in system headers. Try to add #undef ui before that typedef.

2 Likes

Thanks, it worked and eveerything works smoothly now! :smiley: I added an ifdef just in case:

#ifdef ui
#undef ui
#endif

FYI: not a critical error, but Make now fails with the following error at the end: make[2]: Nothing to be done for 'build/release-mingw32-x86.zip'. I currently don’t care, but perhaps something the devs should look into if they want an error free make procedure.

You can safely ignore that…The Makefile just now has an option to zip up the output binaries into a “release” zip

If you actually want to use that feature, just use:
ARCHIVE=1 make
when building

Thanks for all the input, I have reported the bugs:

The UI macro issue is a bug in mingw32, so I’ve closed that bug, and recommend using mingw64, which doesn’t have the issue.

1 Like

Updated cURL using xhairball’s pull request.

1 Like