Compiling wxwidgets under Win 10 Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
mimosa
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Sep 08, 2014 6:16 pm

Compiling wxwidgets under Win 10

Post by mimosa »

wxWidgets 3.1.0
Win 10 64bit
TDM64 GCC 5.1.0-tdm64-1 (32 & 64 bit)

trying to compile wxwidgets library with this config:

Code: Select all

mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
also if I try with adding CXXFLAGS="-std=gnu++11"

and get this error:

Code: Select all

process_begin: CreateProcess(NULL, -c "if not exist gcc_mswudll mkdir gcc_mswudll", ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: [gcc_mswudll] Error 2 (ignored)
process_begin: CreateProcess(NULL, -c "if not exist ..\..\lib\gcc_dll\mswu mkdir ..\..\lib\gcc_dll\mswu", ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [..\..\lib\gcc_dll\mswu] Error 2
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compiling wxwidgets under Win 10

Post by PB »

Not 100% sure I believe this error comes up when you have more than one GCC toolchain in the PATH. I would check what folders are in your PATH and make sure your TDM-GCC installation is the only one with GCC build tools there.
mimosa
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Sep 08, 2014 6:16 pm

Re: Compiling wxwidgets under Win 10

Post by mimosa »

I was able to get some compiling done by adding the option SHELL=CMD.exe, also added -j2 for multicore compiling (faster)
Full command line tried:

Code: Select all

mingw32-make -f makefile.gcc SHELL=CMD.exe -j2 BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
Then I get these errors after 15 minutes of compiling:

Code: Select all

g++: error: gccmswudll\monodll_cmdproc.o: No such file or directory
g++: error: gccmswudll\monodll_xh_frame.o: No such file or directory
makefile.gcc:5283: recipe for target '..\..\lib\gcc_dll\wxmsw310u_gcc_custom.dll' failed
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw310u_gcc_custom.dll] Error 1
mingw32-make: *** Waiting for unfinished jobs...
mimosa
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Sep 08, 2014 6:16 pm

Re: Compiling wxwidgets under Win 10

Post by mimosa »

PB wrote:Not 100% sure I believe this error comes up when you have more than one GCC toolchain in the PATH. I would check what folders are in your PATH and make sure your TDM-GCC installation is the only one with GCC build tools there.
I did verified that only C:\TDM-GCC\bin was in the path, and at the very beginning. There was some path about Visual Studio, but I removed all those and rebooted the machine. Same error when compiling.
mimosa
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Sep 08, 2014 6:16 pm

Re: Compiling wxwidgets under Win 10

Post by mimosa »

I was able to get some more compiling done by forcing the option MONOLITHIC=0, so now the full command line:

Code: Select all

mingw32-make -f makefile.gcc SHELL=CMD.exe -j2 BUILD=release SHARED=1 MONOLITHIC=0 UNICODE=1
Then I get these errors after additional 15 minutes of compiling:

Code: Select all

g++: error: gccmswudll\coredll_collheaderctlg.o: No such file or directory
makefile.gcc:5340: recipe for target '..\..\lib\gcc_dll\wxmsw310u_core_gcc_custom.dll' failed
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw310u_core_gcc_custom.dll] Error 1
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compiling wxwidgets under Win 10

Post by PB »

Mhm, you seem to have run into the "missing characters in file names" bug (related to the MS Windows limits), the file name should be coredll_collheaderctrlg.o

No idea why it happens for some people, does not happen for me. By the way, have you checked this FAQ: https://wiki.wxwidgets.org/Compiling_wx ... leshooting

Additionally, I would start with making sure there are no remnants of the previous build, i.e., delete all the folders starting with gcc_both in WXWIN/build/msw and WXWIN/lib.
mimosa
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Sep 08, 2014 6:16 pm

Re: Compiling wxwidgets under Win 10

Post by mimosa »

I solved it. I tried with the old MingW32 but it wasn't working. Also with TDM-GCC 64 it wasn't working, even though it did compile with what I'm about to share, compiling a project in Debug mode later (with TDM) would have cc1plus.exe to crash (heap problem perhaps?). Anyway, here is what I do to make it compile in Monolithic, using the MingW64 compiler (and adding to PATH this C:\MingW64\bin)

I created a batch file, in order to have the PATH as local and singled out for the compile process and not have any other paths interference. The batch file contains the following (its got 3 user arguments described below):

Code: Select all

@echo off
setlocal
set PATH=C:\MingW64\bin;C:\MingW64\x86_64-w64-mingw32\bin;C:\MingW64\libexec\gcc\x86_64-w64-mingw32\6.3.0
mingw32-make -f makefile.gcc SHARED=0 BUILD=%1 UNICODE=1 MONOLITHIC=%2 CXXFLAGS="-D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -fno-keep-inline-dllexport -std=gnu++11 -static-libgcc -static-libstdc++" %3
endlocal
the user arguments are:
1) 'release' or 'debug' (without the quotes)
2) 1 or 0 (if user wants monolithic or not)
3) empty, or 'clean' to allow for sweeping the dust just in case

Notice the _WIN32_WINNT and WINVER variables both set to 0x0A00. This is the value for Windows 10.

It compiles both for Release and Debug in Monolithic.

The only issue was if using TDM-GCC 64, even though wxWidgets was compiling with the above method (adapting the path for tdm), when I was creating a wxwidgets GUI project in Code-Blocks, with the "pre-compiled header" option, the Debug version was crashing during compile saying the cc1plus.exe has stopped working. If I'd create a project without the pre-compiled header option, then both Release and Debug would compile and run fully. But you want the pre-compile header eventually, because your project always grows and the compile process would take forever (if precompile header is not used). Doing little research, it appears that TDM-GCC 64 is not quite ready for large heap memory or something along those lines. Until then, looks like MingW64 works for me.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Compiling wxwidgets under Win 10

Post by doublemax »

Notice the _WIN32_WINNT and WINVER variables both set to 0x0A00. This is the value for Windows 10.
With this it's possible that the generated executable will run *only* under Windows 10 or higher. Is that what you want?
Use the source, Luke!
mimosa
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Sep 08, 2014 6:16 pm

Re: Compiling wxwidgets under Win 10

Post by mimosa »

I haven't try all the possibilities. It wasn't working if I completely omit these variables. One could try with the value for WinXP and see it it works I suppose.
Post Reply