MinGW Build Error: _XOPEN_SOURCE in mxit

Diego Nieto Cid dnietoc at gmail.com
Mon Mar 2 17:57:14 EST 2015


I'm working on a plugin (pidgin-gntp) for windows and I followed the
instructions listed in the BuildingWinPidgin wiki page.

However, when installing MinGW I used their setup tool which downloaded the
latest GCC package, version 4.8.1.

During the compilation of libpurple/protocols/mxit/profile.c, I am getting
an error related to the preprocessor macro _XOPEN_SOURCE.

Apparently, MinGW header files expect it, if defined, to be a number and
the macro is used in comparisons, as it is showed in the build log below.

Revision 21baa608701d [1] introduced the definition of _XOPEN_SOURCE in the
profile.c compilation unit. However, it is defined as an empty value
leading to errors in system headers.

There are several conformance levels that can be requested by defining
_XOPEN_SOURCE, as described in the relevant man page [2].

As a quick fix, I'm going to define it to the lowest level. But I wanted to
check with you what was intended by defining that macro.

If it is not clear what was intended, anybody knows what MinGW assumed in
prior versions?


[1] https://hg.pidgin.im/pidgin/main/rev/21baa608701d
[2] http://man.he.net/man7/feature_test_macros

Extract of the build log:

make[3]: Entering directory
gcc.exe -O2 -Wall -Waggregate-return -Wcast-align
-Wdeclaration-after-statement -Werror-implicit-function-declaration -Wextra
-Wno-sign-compare -Wno-unused-parameter -Winit-self -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
-Wstack-protector -fwrapv -fno-strict-overflow
-Wno-missing-field-initializers -Wformat-security -fstack-protector-all
--param ssp-buffer-size=1 -pipe -mms-bitfields -g -DHAVE_CYRUS_SASL
-I../../../libpurple -I../../../libpurple/win32 -I../../.. -o profile.o -c
In file included from d:\diego\programacion\mingw-0.6.2\include\time.h:15:0,
                 from profile.c:27:
d:\diego\programacion\mingw-0.6.2\include\_mingw.h:396:21: error: operator
'<' has no left operand
 #  if _XOPEN_SOURCE < 500
d:\diego\programacion\mingw-0.6.2\include\_mingw.h:399:23: error: operator
'<' has no left operand
 #  elif _XOPEN_SOURCE < 600
d:\diego\programacion\mingw-0.6.2\include\_mingw.h:402:23: error: operator
'<' has no left operand
 #  elif _XOPEN_SOURCE < 700
make[3]: *** [profile.o] Error 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pidgin.im/pipermail/devel/attachments/20150302/4a7b0084/attachment.html>

More information about the Devel mailing list