MinGW Build Error: _XOPEN_SOURCE in mxit

Diego Nieto Cid dnietoc at gmail.com
Wed Mar 25 10:15:27 EDT 2015


Hi Andrew

I add you to a discussion about a mxit change in libpurple which is causing
some trouble to compile the source under MinGW's latest version of gcc.

El mié., 25 de marzo de 2015 a las 1:25, Jorge Villaseñor (<
salinasv at gmail.com>) escribió:

> On Mon, Mar 2, 2015 at 2:57 PM, Diego Nieto Cid <dnietoc at gmail.com> wrote:
>
>> Hi
>>
>> 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.
>>
>
I finally used the recommended version (4.7.2) because the plugin was
crashing pidgin on exit.

Apparently, it was a problem in the stack smashing protection library
(libssp) used by GCC which was incompatible with the one pidgin linked to.


>
>> 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.
>>
>
Using the lowest level worked just fine. So, with the definition

    #define _XOPEN_SOURCE 1

pidgin compiled correctly.


>
>> If it is not clear what was intended, anybody knows what MinGW assumed in
>> prior versions?
>>
>
After installing version 4.7.2, I can confirm that MinGW did not check the
value of that macro. It only tested whether it was defined or not.


>
>> Thanks!
>>
>> --
>> [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 `/src/pidgin/src-2.10.11/
>> libpurple/protocols/mxit'
>> 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
>> -DHAVE_CONFIG_H -DWIN32_LEAN_AND_MEAN -I. -I../../../../win32-dev/gtk_2_0-2.14/include
>> -I../../../../win32-dev/gtk_2_0-2.14/include/glib-2.0
>> -I../../../../win32-dev/gtk_2_0-2.14/lib/glib-2.0/include
>> -I../../../libpurple -I../../../libpurple/win32 -I../../.. -o profile.o -c
>> profile.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
>>
>
> This looks like a mxit change. I am not sure they Andrew monitors this
> mailing list. I think you may have better luck if you address the mxit
> development forums or him directly.
>

Thanks Jorge, I added Andrew to the discussion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pidgin.im/pipermail/devel/attachments/20150325/4f092b51/attachment.html>


More information about the Devel mailing list