Bug 6087 - q3_ui doesn't build on Windows 7/8 MinGW GCC 4.8.1
Status: RESOLVED WONTFIX
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: PC other
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2014-02-10 07:44 EST by Stig M. Halvorsen
Modified: 2021-11-02 15:31:24 EDT
2 users (show)

See Also:


Attachments
Demonstrates a bug in mingw32 gcc. (1.39 KB, text/plain)
2014-02-10 15:37 EST, James Canete

Description Stig M. Halvorsen 2014-02-10 07:44:05 EST
Building q3_ui wil fail and break the entire build process if you build a branch with the cURL issue (https://bugzilla.icculus.org/show_bug.cgi?id=6086) patched due to a strange macro issue:

----------

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;
 ^

----------

This is because the union uses "ui" as a member which is somehow defined as a macro in the build process. I have not been able to locate the definition of the ui macro. I have attempted searching for it using grep and listing all GCC predefinitions (gcc -dM -E - < /dev/null). It is not in the Makefile either.

The error does not occur on Ubuntu, OSX or if I use CC=clang in MinGW.

Adding this in q_shared.h before the union declaration resolves the issue:

----------

#ifdef ui
#undef ui
#endif

----------

It can also potentially be fixed by refactoring the union member variable's name.

Other resources regarding this topic:
 - http://community.ioquake.org/t/building-ioquake3-using-mingw-on-windows-7-fails/198
 - http://openarena.ws/board/index.php?topic=4925.msg50279
Comment 1 James Canete 2014-02-10 15:37:06 EST
Created attachment 3409 [details]
Demonstrates a bug in mingw32 gcc.

This is a bug in mingw32, not ioq3.

It appears that if there is a subdirectory with the same name as a macro, the macro magically becomes case insensitive.

I've attached a text file demonstrating the bug, recommending the use of mingw64, which doesn't have this bug, and closing this.  In addition, this is not msys specific, I have tried it in cmd.exe with the mingw32 compiler and seen the same behaviour.
Comment 2 James Canete 2014-02-10 15:38:27 EST
Resolving as wontfix.