Page 1 of 1

[SOLVED] Can't compile wxWidgets-3.0.4

Posted: Sat Jul 06, 2019 10:31 am
by Slyde
I'm on a fresh install of Windows 10. I installed CodeLite 13 and downloaded wxWidgets-3.0.4 and installed the files to C:\wxWidgets-3.0.4. I then opened a console window and changed directories to C:\wxWidgets-3.0.4\build\msw and ran

Code: Select all

 msw>mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
It was compiling away, then it stopped.

Code: Select all

gcc -c -o gcc_mswudll\wxtiff_tif_win32.o  -O2 -mthreads  -DHAVE_W32API_H -DNDEBUG -I..\..\src\zlib -I..\..\src\jpeg -I..\..\src\tiff\libtiff   -MTgcc_mswudll\wxtiff_tif_win32.o -MFgcc_mswudll\wxtiff_tif_win32.o.d -MD -MP ../../src/tiff/libtiff/tif_win32.c
In file included from ../../src/tiff/libtiff/tiffio.h:257,
                 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:5942: recipe for target 'gcc_mswudll\wxtiff_tif_win32.o' failed
mingw32-make: *** [gcc_mswudll\wxtiff_tif_win32.o] Error 1
I have no idea what's missing. Any and all help is appreciated. Thanks.

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 06, 2019 1:01 pm
by PB
I recommend searching for the problem before creating a new post, it will save you time and effort.

The issue is discussed (including possible solutions) e.g. here
viewtopic.php?f=19&t=44282&hilit=__mingw_stdio_redirect__

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 06, 2019 10:25 pm
by Slyde
Yeah. Your answer might have possibly been a good solution, but it wasn't. I even removed the version of wxWidgets I had (3.0.4) and got the newest (3.1.2) and tried compiling it. And while I got way past where 3.0.4 crapped out, 3.1.2 also bit the dust before successfully compiling.

Code: Select all

g++ -c -o gcc_mswudll\coredll_msw_listctrl.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_dll\mswu -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\expat\lib -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy   -MTgcc_mswudll\coredll_msw_listctrl.o -MFgcc_mswudll\coredll_msw_listctrl.o.d -MD -MP ../../src/msw/listctrl.cpp
../../src/msw/listctrl.cpp: In member function 'long int wxListCtrl::HitTest(const wxPoint&, int&, long int*) const':
../../src/msw/listctrl.cpp:1778:64: error: expected ')' before ';' token
         item = ListView_SubItemHitTest(GetHwnd(), &hitTestInfo);
                                                                ^
In file included from ..\..\include/wx/msw/wrapcctl.h:16,
                 from ../../src/msw/listctrl.cpp:31:
../../src/msw/listctrl.cpp:1778:16: note: to match this '('
         item = ListView_SubItemHitTest(GetHwnd(), &hitTestInfo);
                ^~~~~~~~~~~~~~~~~~~~~~~
makefile.gcc:12528: recipe for target 'gcc_mswudll\coredll_msw_listctrl.o' failed
mingw32-make: *** [gcc_mswudll\coredll_msw_listctrl.o] Error 1
My compiler:

Code: Select all

C:\wxWidgets-3.1.2\build\msw>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-3' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable-build-format-warnings
Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-3)
I don't mind using Qt or Visual Studio, but I'd rather use Code::Blocks and/or CodeLite with wxWidgets. So if anyone can help me here, I'd appreciate you.

Re: Can't compile wxWidgets-3.0.4

Posted: Sun Jul 07, 2019 7:00 am
by PB
Slyde wrote: Sat Jul 06, 2019 10:25 pm Yeah. Your answer might have possibly been a good solution, but it wasn't.
I am sorry, I do not understand? The solution I provided fixed the error you asked about so how comes it was not a good solution? You failing again with a different error has no relevance. And as the only information about the compiler you provided in that post was GCC 7.3.1 in your signature it was impossible to warn you about the GCC 8.2 bug.

Once again, I recommend searching* for such issues, very often it is both faster and easier to get a solution. Your new issue seems to be this bug in that version of the compiler toolchain (header files, fixed in 8.3), see here
https://trac.wxwidgets.org/ticket/18349

* By searching I mean using the relevant part of the build error and wxWidgets as the search phrase. E.g., for the first issue I used "__mingw_stdio_redirect__(snprintf) wxwidgets" and got this
snp.png
and for the second I searched for "wxwidgets ListView_SubItemHitTest gcc"
lv.png
lv.png (70.07 KiB) Viewed 3399 times
Hope it helps.

By the way, you can use basically any compiler in Code::Blocks and setting it up there is quite easy. IMO, currently the best MinGW-based compiler toolchain is mingw-w64.

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 13, 2019 8:20 am
by Slyde
Hi PB:

I apologize for replying to you the way I did. No excuses, I was wrong.

Now, moving on here, the compiler was actually telling me all I needed to know. Compiler file name and even the line of the error. So I added the missing closing brace. That got me past the second error. Now I have another one:

Code: Select all

../../src/msw/statusbar.cpp:126:28: error: 'STATUSCLASSNAME' was not declared in this scope
     if ( !MSWCreateControl(STATUSCLASSNAME, wxString(),
                            ^~~~~~~~~~~~~~~
../../src/msw/statusbar.cpp:126:28: note: suggested alternative: 'STATUSCLASSNAMEA'
     if ( !MSWCreateControl(STATUSCLASSNAME, wxString(),
                            ^~~~~~~~~~~~~~~
                            STATUSCLASSNAMEA
makefile.gcc:12591: recipe for target 'gcc_mswudll\coredll_statusbar.o' failed
mingw32-make: *** [gcc_mswudll\coredll_statusbar.o] Error 1
In statusbar.cpp, this is the code throwing the error:

Code: Select all

if ( !MSWCreateControl(STATUSCLASSNAME, wxString(),
                           wxDefaultPosition, wxDefaultSize) )
        return false;
I've Googled and searched here with no luck. I opened statusbar.cpp found just one instance of STATUSCLASSNAME. Maybe wxWidgets just isn't for me on Windows. I had zero issues when I setup Code::Blocks and wxWidgets on Linux Mint. But getting those two together on Windows is becoming a nightmare.

wxWidgets 3.1.2
gcc 8.2.0.

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 13, 2019 9:39 am
by doublemax
Editing wx sources or moving header files etc. should not be necessary. Building wx with MinGW should work out of the box - and it does 99% of the time.

If i had to guess i'd say your GCC version is too new. Start with the one that comes with CodeBlocks (5.1.0) and if that works, you can experiment with newer ones.

And check your PATH and make sure there are no other toolchains active.

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 13, 2019 10:33 am
by Slyde
Thanks, doublemax. That's all it needed. Got it compiled using minGW from C::B. Not one issue. Much appreciated.
Editing wx sources or moving header files etc. should not be necessary.
That was a minGW header file I edited. It lacked a closing brace in a particular header. So I added it to get past the second error I was having. Looks like they sent out their compiler before it was ready.

One more question: I used:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
Do I need to run that again using BUILD=debug?

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 13, 2019 11:05 am
by doublemax
Do I need to run that again using BUILD=debug?
Yes.
It also tells me it can't find the release. I'm confused. I just did the release build.
That usually means that one of the settings you made on the previous screen(s) does not match the configuration with which wxWidgets was built.

viewtopic.php?p=169501&sid=8b310aedd398 ... 93#p169501
(Beware that this was written for wx 3.0.x)

Re: Can't compile wxWidgets-3.0.4

Posted: Sat Jul 13, 2019 11:10 am
by Slyde
That was my fault. I had it set to wxWidgets 3.0 instead of 3.1. It works now. Thanks. And I'm not usually a tard like this. Just been a long day.

Check this out, doublemax