Search code examples
mingwwxwidgets

wxwidget compilation failing with mingw


I am compiling wxWidgets-3.1.0 with below command :

C:\wxWidgets-3.1.0\build\msw>mingw32-make -f makefile.gcc
if not exist ..\..\lib\gcc_lib\mswud mkdir ..\..\lib\gcc_lib\mswud
gcc -c -o gcc_mswud\wxtiff_tif_win32.o -g -O0 -mthreads  -DHAVE_W32API_H -DNDEBUG -I..\..\src\zlib -I..\..\src\jpeg -I..\..\src\tiff\libtiff   -MTgcc_mswud\wxtiff_tif_win32.o -MFgcc_mswud\wxtiff_tif_win32.o.d -MD -MP ../../src/tiff/libtiff/tif_win32.c
In file included from ../../src/tiff/libtiff/tiffio.h:257:0,
                from ../../src/tiff/libtiff/tiffiop.h:59,
                from ../../src/tiff/libtiff/tif_win32.c:30:
c:\mingw\include\stdio.h:345:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__mingw__snprintf'
extern int __mingw_stdio_redirect__(snprintf)(char*, size_t, const char*, ...);
            ^
makefile.gcc:6018: recipe for target 'gcc_mswud\wxtiff_tif_win32.o' failed
mingw32-make: *** [gcc_mswud\wxtiff_tif_win32.o] Error 1

I looked the link for solution, that is not helping.

Followed this also, but getting different errors :

c:\mingw\include\stdio.h:345:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__mingw__snprintf'
extern int __mingw_stdio_red.oirect]);_
            ^
E_(snprintf)(char*, size_t, const char*, ...);
            ^
rror 1
mingw32-make: *** Waiting for unfinished jobs....
Makefile.gcc:6024: recipe for target 'gcc_mswudll\wxtiff_tif_close.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_close.o] Error 1
Makefile.gcc:6027: recipe for target 'gcc_mswudll\wxtiff_tif_codec.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_codec.o] Error 1
Makefile.gcc:6030: recipe for target 'gcc_mswudll\wxtiff_tif_color.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_color.o] Error 1
Makefile.gcc:6033: recipe for target 'gcc_mswudll\wxtiff_tif_compress.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_compress.o] Error 1
Makefile.gcc:6018: recipe for target 'gcc_mswudll\wxtiff_tif_win32.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_win32.o] Error 1
In file included from ../../src/tiff/Mlaikbtiffe/tiffio.h:257:0,
f                 fromi le.gcc:6036.:. recipe for target 'gcc_mswudll\wxtiff_tif_dir.o' faile/d
../srcm/tiff/libtiff/tiffiopi.h:59,
n           g     fromw ../../src/t3iff/libtiff/tif_dirinfo.c:31:
c2:\mi-ngw\include\stdio.h:345:12: error: expected 'm=', ','a, ';', 'kasme' o:r '__attribute__' before ' __m*ing*w__*snp rint[f'
extern int __mingw_stdio_redirect__(snprintf)(char*, size_t, const char*, ...);
            ^
_mswudll\wxtiff_tif_dir.o] Error 1
Makefile.gcc:6039: recipe for target 'gcc_mswudll\wxtiff_tif_dirinfo.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_dirinfo.o] Error 1

I have set environment variables for

WXCFG=C:\wxWidgets-3.1.0\lib\gcc_dll\mswu
WXWIN=C:\wxWidgets-3.1.0

Solution

  • I'm pretty sure your running into the issue described here.

    You can either

    1. Apply the patch from here to fix the issue.
    2. Use the latest version of wxWidgets from git, since the issue has been fixed there.
    3. Use a version of MinGW from either MSYS2 or MinGW64. Although if you go that route, be sure to use the latest release because those versions of MinGW has a different problem (at least for some configurations of wxWidgets) until very recently.

    I hope that helps.