How do I Compile wxWidgets Sample Code? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: How do I Compile wxWidgets Sample Code?

Post by ColleenKobe »

PB, yes, of course, you are correct. I just downloaded the source code, and I recompiled it all using the commands I listed above. D'oh.

Dependency Walker works for you on your Windows 10, 64-bit machine? Well, that's good to know! Gives me hope for running DW on my computer someday.

Here are the Q&As you requested.

Code: Select all

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

U:\>where libgcc_s_dw2-1.dll
C:\MinGW\bin\libgcc_s_dw2-1.dll

U:\>where libstdc++-6.dll
C:\MinGW\bin\libstdc++-6.dll

U:\>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls
Thread model: win32
gcc version 4.9.3 (GCC)

U:\>
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: How do I Compile wxWidgets Sample Code?

Post by PB »

I'm sorry, I'm out of ideas then. All this should be really simple and work out of the box (assuming there is not some bug in GCC 4.9.3 causing the issue, which is not very likely, I guess).

I would just really clean wxWidgets, i.e., delete all folders starting with gcc_ both in build\msw and lib folders. Alternatively, you can create a new wxWidgets folder somewhere, where you install a fresh version. I would then rebuild wxWidgets in the desired configuration(s).

I would also delete the gcc_lib folder in the dataview sample and tried to rebuild the sample. Alternatively, I could just clean the sample and try to compile it before I would try to clean and rebuild wxWidgets.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How do I Compile wxWidgets Sample Code?

Post by ONEEYEMAN »

Or there is a 3rd alternative - start a fresh.
Get a clean machine, install MinGW, unpack wxWidgets and compile. Then when you are done - continue developing on you old computer.

Thank you.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: How do I Compile wxWidgets Sample Code?

Post by ColleenKobe »

I actually did delete C:\wxWidgets\samples\dataview\gcc_mswud and rebuild, several times. But when I ran the resulting dataview.exe, I still got the 0xc000007b error. Tried running dataview.exe as an administrator, but got the error then, too.

So, clearly, something in my configuration is hosed. A burn-down and rebuild is called for. *siiiigh* Tedious, but an okay task for a Friday afternoon. :-)

Thank you, PB and everyone else, for your tenacity in trying to get this to work. I learned some new things and it was great to get a working build command for the original wxWidgets source code!

Here's what I'll do.

1. Save the command files that I made.
2. Delete c:\wxWidgets.
3. Download the latest-and-greatest wxWidgets and install.
4. Compile all.
5. And theeeennnnn.....try building the dataview.exe sample again!!!

Have a great weekend!

Colleen
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How do I Compile wxWidgets Sample Code?

Post by ONEEYEMAN »

Colleen,
Just make sure you have a one folder in the path - that points to you existing compiler.
That's why I suggested to start a fresh and install everything from scratch.

Trouble is - you system directory might be polluted with the different gcc/MinGW/TDM-gcc versions which will prevent you from running properly.

Thank you.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: How do I Compile wxWidgets Sample Code?

Post by ColleenKobe »

OneEyeMan, you raise a good point.

Regarding the different gcc/MinGW/TDM-gcc software versions on my computer. My system path is now (broken up for legibility):

Code: Select all

%SystemRoot%;
%SystemRoot%\system32\;
%SystemRoot%\System32\Wbem\;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Windows\system32\config\systemprofile\.dnx\bin\;
C:\ProgramData\Oracle\Java\javapath\;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Program Files\Intel\WiFi\bin\;
C:\Program Files\Common Files\Intel\WirelessCommon\;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static\;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86\;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64\;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL\;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT\;
C:\Program Files\Microsoft DNX\Dnvm\;
C:\Program Files (x86)\KEDITW\;
C:\Program Files (x86)\KEDITW\User\;
C:\MinGW\bin\;
C:\wxWidgets\bin\;
C:\wxWidgets\;
C:\wxWidgets\build\msw\gcc_mswu\;
C:\wxWidgets\include\;
C:\wxWidgets\lib\gcc_dll\;
F:\;
F:\util\;
So notice there is no C:\TDM-GCC-32\ in the path. Frankly, I don't even know why I have TDM-GCC-32 on my computer. Maybe it was for one of the previous software environments I was working in.

After thinking about what you said, I ended up not only deleting the whole C:\wxWidgets folder, but I also deleted C:\MinGW. I downloaded and installed C:\MinGW first, and then downloaded and installed C:\wxWidgets. It was partway through compiling when the compilation came to an abrupt halt. Here is where it stopped:

Code: Select all

.
.
.
if exist ..\..\lib\gcc_lib\libwxbase31u_net.a del ..\..\lib\gcc_lib\libwxbase31u_net.a
ar rcu ..\..\lib\gcc_lib\libwxbase31u_net.a gcc_mswu\netlib_dummy.o gcc_mswu\netlib_fs_inet.o gcc_mswu\netlib_ftp.o gcc_mswu\netlib_http.o gcc_mswu\netlib_protocol.o gcc_mswu\netlib_sckaddr.o gcc_mswu\netlib_sckfile.o gcc_mswu\netlib_sckipc.o gcc_mswu\netlib_sckstrm.o gcc_mswu\netlib_socket.o gcc_mswu\netlib_url.o gcc_mswu\netlib_sockmsw.o gcc_mswu\netlib_urlmsw.o
ranlib ..\..\lib\gcc_lib\libwxbase31u_net.a
g++ -c -o gcc_mswu\corelib_dummy.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_dummy.o -MFgcc_mswu\corelib_dummy.o.d -MD -MP ../../src/common/dummy.cpp
g++ -c -o gcc_mswu\corelib_event.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_event.o -MFgcc_mswu\corelib_event.o.d -MD -MP ../../src/common/event.cpp
g++ -c -o gcc_mswu\corelib_fs_mem.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_fs_mem.o -MFgcc_mswu\corelib_fs_mem.o.d -MD -MP ../../src/common/fs_mem.cpp
g++ -c -o gcc_mswu\corelib_msgout.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_msgout.o -MFgcc_mswu\corelib_msgout.o.d -MD -MP ../../src/common/msgout.cpp
g++ -c -o gcc_mswu\corelib_utilscmn.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_utilscmn.o -MFgcc_mswu\corelib_utilscmn.o.d -MD -MP ../../src/common/utilscmn.cpp
g++ -c -o gcc_mswu\corelib_main.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_main.o -MFgcc_mswu\corelib_main.o.d -MD -MP ../../src/msw/main.cpp
g++ -c -o gcc_mswu\corelib_volume.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_volume.o -MFgcc_mswu\corelib_volume.o.d -MD -MP ../../src/msw/volume.cpp
g++ -c -o gcc_mswu\corelib_activex.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_activex.o -MFgcc_mswu\corelib_activex.o.d -MD -MP ../../src/msw/ole/activex.cpp
g++ -c -o gcc_mswu\corelib_app.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_app.o -MFgcc_mswu\corelib_app.o.d -MD -MP ../../src/msw/app.cpp
../../src/msw/app.cpp: In member function 'bool {anonymous}::wxConsoleStderr::DoInit()':
../../src/msw/app.cpp:380:11: error: '::AttachConsole' has not been declared
     if ( !::AttachConsole(ATTACH_PARENT_PROCESS) )
           ^
makefile.gcc:14210: recipe for target 'gcc_mswu\corelib_app.o' failed
mingw32-make.exe: *** [gcc_mswu\corelib_app.o] Error 1

C:\wxWidgets\build\msw>
I don't know WHAT happened here. This error didn't come up when I rebuilt wxWidgets before, earlier today.

I will think about this over the weekend, and pick it up again Monday.

Colleen
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: How do I Compile wxWidgets Sample Code?

Post by PB »

ColleenKobe wrote:After thinking about what you said, I ended up not only deleting the whole C:\wxWidgets folder, but I also deleted C:\MinGW. I downloaded and installed C:\MinGW first, and then downloaded and installed C:\wxWidgets. It was partway through compiling when the compilation came to an abrupt halt. Here is where it stopped:

Code: Select all

.
.
.
if exist ..\..\lib\gcc_lib\libwxbase31u_net.a del ..\..\lib\gcc_lib\libwxbase31u_net.a
ar rcu ..\..\lib\gcc_lib\libwxbase31u_net.a gcc_mswu\netlib_dummy.o gcc_mswu\netlib_fs_inet.o gcc_mswu\netlib_ftp.o gcc_mswu\netlib_http.o gcc_mswu\netlib_protocol.o gcc_mswu\netlib_sckaddr.o gcc_mswu\netlib_sckfile.o gcc_mswu\netlib_sckipc.o gcc_mswu\netlib_sckstrm.o gcc_mswu\netlib_socket.o gcc_mswu\netlib_url.o gcc_mswu\netlib_sockmsw.o gcc_mswu\netlib_urlmsw.o
ranlib ..\..\lib\gcc_lib\libwxbase31u_net.a
g++ -c -o gcc_mswu\corelib_dummy.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_dummy.o -MFgcc_mswu\corelib_dummy.o.d -MD -MP ../../src/common/dummy.cpp
g++ -c -o gcc_mswu\corelib_event.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_event.o -MFgcc_mswu\corelib_event.o.d -MD -MP ../../src/common/event.cpp
g++ -c -o gcc_mswu\corelib_fs_mem.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_fs_mem.o -MFgcc_mswu\corelib_fs_mem.o.d -MD -MP ../../src/common/fs_mem.cpp
g++ -c -o gcc_mswu\corelib_msgout.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_msgout.o -MFgcc_mswu\corelib_msgout.o.d -MD -MP ../../src/common/msgout.cpp
g++ -c -o gcc_mswu\corelib_utilscmn.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_utilscmn.o -MFgcc_mswu\corelib_utilscmn.o.d -MD -MP ../../src/common/utilscmn.cpp
g++ -c -o gcc_mswu\corelib_main.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_main.o -MFgcc_mswu\corelib_main.o.d -MD -MP ../../src/msw/main.cpp
g++ -c -o gcc_mswu\corelib_volume.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_volume.o -MFgcc_mswu\corelib_volume.o.d -MD -MP ../../src/msw/volume.cpp
g++ -c -o gcc_mswu\corelib_activex.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_activex.o -MFgcc_mswu\corelib_activex.o.d -MD -MP ../../src/msw/ole/activex.cpp
g++ -c -o gcc_mswu\corelib_app.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\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\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -std=gnu++11 -MTgcc_mswu\corelib_app.o -MFgcc_mswu\corelib_app.o.d -MD -MP ../../src/msw/app.cpp
../../src/msw/app.cpp: In member function 'bool {anonymous}::wxConsoleStderr::DoInit()':
../../src/msw/app.cpp:380:11: error: '::AttachConsole' has not been declared
     if ( !::AttachConsole(ATTACH_PARENT_PROCESS) )
           ^
makefile.gcc:14210: recipe for target 'gcc_mswu\corelib_app.o' failed
mingw32-make.exe: *** [gcc_mswu\corelib_app.o] Error 1

C:\wxWidgets\build\msw>
I don't know WHAT happened here. This error didn't come up when I rebuilt wxWidgets before, earlier today.
Colleen
I think you have run into this bug (already fixed in the master): http://trac.wxwidgets.org/ticket/17677. I believe this bug was regression that appeared in GCC 5.3 (which you are probably using now) but not in the 4.9 you used before.


Regarding wxWidgets versions and builds: you should verify with your team which version (3.0.x, 3.1.x, ...) and build (shared/static, monolithic/multilib) your task requires. Same with the compiler version and flavour (MinGW, TDM-GCC,...). This applies to C++ version too (C++98, C++11, GNU++11,...).

Regarding a computer reinstall. I dare to disagree with ONEEYEMAN and think you are safe. You can always verify that with the where command. I would also keep the build simple, i.e., build a static debug multilib version of wxWidgets with

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
and build the sample with the exactly same command line.

BTW, if your computer has more than one CPU core and a decent (high IOPS) SSD (most PCs do these days), you can significantly speed up the build process by using parallel building, e.g.

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11" setup_h
mingw32-make -j2 -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
The first line is necessary when using parallel build, to build the setup_h target first. Notice the parameter "-j" in the second line, the number after it tells the compiler how many cores to use (2 in the code above). In the meantime, I again recommend reading WXWIN\docs\msw\install.txt, it can really save one a lot of time and frustration. ;)
Last edited by PB on Fri Jul 07, 2017 8:37 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How do I Compile wxWidgets Sample Code?

Post by ONEEYEMAN »

Hi,
@PB, I don't know how MinGW/gcc/TDM-gcc is installed. Does it copy something in the system pathes - C:\Windows\{System{32}}, C:\Program Files{64}? Because when the program starts, it is looking for the libraries in that directories and if there are mix...
@Colleen, Yes, I would check with you team about everything PB said. Also, since you building the sample just to check it/experiment with it I would just do a simple multilib debug build for the library and the sample, check the sample and then go back to your dev environment.

Just make sure you backport that fix from the ticket PB mentions if you will need the 5.3 compiler version...

Thank you.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: How do I Compile wxWidgets Sample Code?

Post by PB »

ONEEYEMAN wrote:Hi,
@PB, I don't know how MinGW/gcc/TDM-gcc is installed. Does it copy something in the system pathes - C:\Windows\{System{32}}, C:\Program Files{64}?
To my best knowledge, neither of the two installs anything outside their respective directories.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: How do I Compile wxWidgets Sample Code?

Post by stahta01 »

Note: The environment variables WXCFG and WXWIN are needed in CodeLite when you are trying to use its wx-config.exe which is an wxWidgets helper tool. I helped update the tool about 2 years back.

And, I agree with the other posters Static Monolithic build is NOT a good idea to use.
While, Shared Monolithic build is only tested a small amount; I would guess Static Monolithic build is NOT tested at all.

Tim S.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: How do I Compile wxWidgets Sample Code?

Post by ColleenKobe »

@PB, @stahta01, @ONEEYEMAN--thank you for responding so quickly.
I think you have run into this bug (already fixed in the master): http://trac.wxwidgets.org/ticket/17677. I believe this bug was regression that appeared in GCC 5.3 (which you are probably using now) but not in the 4.9 you used before.
Okay, here's a point that confuses me. You mentioned GCC. I'm writing wxWidgets code and have downloaded wxWidgets and MinGW. At the moment, I want to do command-line compiles. In the past, I've installed both C:\MinGW and TDM-GCC. They are both "flavors" of gcc, is that right? Do I need both of them? Or just one? How do I choose which one I need?
Regarding wxWidgets versions and builds: you should verify with your team which version (3.0.x, 3.1.x, ...) and build (shared/static, monolithic/multilib) your task requires. Same with the compiler version and flavour (MinGW, TDM-GCC,...). This applies to C++ version too (C++98, C++11, GNU++11,...).
There is no team. There is just me. I work in a 15-person company. My project engineer and the company owner give me direction, but I don't work "with" anyone. This gives me the freedom to choose the correct versions of software I need, which means I come here, to talk with you guys. You know more than I do.
Regarding a computer reinstall. I dare to disagree with ONEEYEMAN and think you are safe. You can always verify that with the where command. I would also keep the build simple, i.e., build a static debug multilib version of wxWidgets with

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
and build the sample with the exactly same command line.
Thank you!
BTW, if your computer has more than one CPU core and a decent (high IOPS) SSD (most PCs do these days), you can significantly speed up the build process by using parallel building, e.g.

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11" setup_h
mingw32-make -j2 -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
The first line is necessary when using parallel build, to build the setup_h target first. Notice the parameter "-j" in the second line, the number after it tells the compiler how many cores to use (2 in the code above). In the meantime, I again recommend reading WXWIN\docs\msw\install.txt, it can really save one a lot of time and frustration. ;)
Thank you ! I will try that next time I build. My computer has one Intel Core i5-4460 CPU @3.20 GHz. I don't know what will happen if I specify the multi-processor option, but I'll find out. If the command fails, I'll just take the option out.


@stahta01--
Note: The environment variables WXCFG and WXWIN are needed in CodeLite when you are trying to use its wx-config.exe which is an wxWidgets helper tool. I helped update the tool about 2 years back.
Thank you! I do plan to keep setting WXCFG and WXWIN from inside CodeLite (via Settings, Environment Variables).
And, I agree with the other posters Static Monolithic build is NOT a good idea to use.
While, Shared Monolithic build is only tested a small amount; I would guess Static Monolithic build is NOT tested at all.
Got it! No more monolithic builds for me. :-D

@ONEEYEMAN--

...
@Colleen, Yes, I would check with you team about everything PB said. Also, since you building the sample just to check it/experiment with it I would just do a simple multilib debug build for the library and the sample, check the sample and then go back to your dev environment.
Will do!
Just make sure you backport that fix from the ticket PB mentions if you will need the 5.3 compiler version...
I will keep that in mind. It sounds tricky, but if I need it, I'll do it.

Colleen
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How do I Compile wxWidgets Sample Code?

Post by ONEEYEMAN »

Hi, Colleen,
ColleenKobe wrote: @PB, @stahta01, @ONEEYEMAN--thank you for responding so quickly.
No problem. We are here to help ;-)
ColleenKobe wrote:
I think you have run into this bug (already fixed in the master): http://trac.wxwidgets.org/ticket/17677. I believe this bug was regression that appeared in GCC 5.3 (which you are probably using now) but not in the 4.9 you used before.
Okay, here's a point that confuses me. You mentioned GCC. I'm writing wxWidgets code and have downloaded wxWidgets and MinGW. At the moment, I want to do command-line compiles. In the past, I've installed both C:\MinGW and TDM-GCC. They are both "flavors" of gcc, is that right? Do I need both of them? Or just one? How do I choose which one I need?
You are correct - they both are gcc flavors. Therefore you need only one. It is you and your company choice which one to use and which version of the compiler to use.
If you need C++11, I would pick up 5.x compiler and then ask you boss which one to use.
ColleenKobe wrote:
Regarding wxWidgets versions and builds: you should verify with your team which version (3.0.x, 3.1.x, ...) and build (shared/static, monolithic/multilib) your task requires. Same with the compiler version and flavour (MinGW, TDM-GCC,...). This applies to C++ version too (C++98, C++11, GNU++11,...).
There is no team. There is just me. I work in a 15-person company. My project engineer and the company owner give me direction, but I don't work "with" anyone. This gives me the freedom to choose the correct versions of software I need, which means I come here, to talk with you guys. You know more than I do.
Then it is much easier. Just keep in mind that if there is another library that you guys will use, you should choose the same compiler as you could get a conflicting issue.
ColleenKobe wrote:
Regarding a computer reinstall. I dare to disagree with ONEEYEMAN and think you are safe. You can always verify that with the where command. I would also keep the build simple, i.e., build a static debug multilib version of wxWidgets with

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
and build the sample with the exactly same command line.
Thank you!
This point is moot since, according to @PB nothing is installed in the Windows system directories.
ColleenKobe wrote:
BTW, if your computer has more than one CPU core and a decent (high IOPS) SSD (most PCs do these days), you can significantly speed up the build process by using parallel building, e.g.

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11" setup_h
mingw32-make -j2 -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
The first line is necessary when using parallel build, to build the setup_h target first. Notice the parameter "-j" in the second line, the number after it tells the compiler how many cores to use (2 in the code above). In the meantime, I again recommend reading WXWIN\docs\msw\install.txt, it can really save one a lot of time and frustration. ;)

Thank you ! I will try that next time I build. My computer has one Intel Core i5-4460 CPU @3.20 GHz. I don't know what will happen if I specify the multi-processor option, but I'll find out. If the command fails, I'll just take the option out.

@ONEEYEMAN--

...
@Colleen, Yes, I would check with you team about everything PB said. Also, since you building the sample just to check it/experiment with it I would just do a simple multilib debug build for the library and the sample, check the sample and then go back to your dev environment.
Will do!
Just make sure you backport that fix from the ticket PB mentions if you will need the 5.3 compiler version...
I will keep that in mind. It sounds tricky, but if I need it, I'll do it.
There is nothing tricky about it. Just open the ticket open the patch that was used to fix it (keep in mind there might be many attachment/patches - you need the one that was used in the commit) and make all necessary modifications to the code you have. Build the library, making sure everything compiles. Then just for future references put the modified sources somewhere on the server and mark it (i.e. wxWidgets-3.0-fixed).
Colleen
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: How do I Compile wxWidgets Sample Code?

Post by PB »

I believe that Vadim Zeitlin, a long-time wxWidgets maintainer, recommends to use TDM-GCC over MinGW on MSW, as it has had the least amount of issues with wxWidgets, see e.g. the post here: https://groups.google.com/d/msg/wx-user ... FhgsF_AgAJ.

Just so you know, if you install TDM-GCC, it may target 64-bit as default. If you do not want that, you may be better off downloading TDM-GCC-32. You can still build 32-bit libraries and applications with TDM-GCC-64 but you may need to jump through few extra hoops to do that.

Unless your job demands otherwise, I would recommend building wxWidgets in static multilib builds both for Debug and Release configurations, e.g. with a batch file like this

Code: Select all

PATH=C:\TDM-GCC-64\bin;%PATH%

REM static debug build
mingw32-make -f makefile.gcc BUILD=debug setup_h
mingw32-make -j2 -f makefile.gcc BUILD=debug

REM static release build
mingw32-make -f makefile.gcc BUILD=release setup_h
mingw32-make -j2 -f makefile.gcc BUILD=release
Your I5 has 4 cores, so you may experiment with increasing the value of -j parameter to 3 or 4 to see if the compilation gets to speed up.

Also make sure you use the matching wxcfg in CodeLite project settings, i.e., wxcfg=gcc_lib/mswud for the Debug configuration and wxcfg=gcc_lib/mswu for the Release one. At least I think it is like this, I have virtually no experience with CodeLite.

Just be sure there are no remnants of the previous build, you could always use the makefile with "clean" target, e.g.

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug clean
mingw32-make -f makefile.gcc BUILD=release clean
I usually just (as a part of batch file) delete all folders starting with gcc_ from both WXWIN/build/msw and WXWIN/lib.

If you need modern C++ (C++11, C++14), then add the appropriate CXX flag to all build command lines, e.g. for gnu++11

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug setup_h
mingw32-make -j2 -f makefile.gcc BUILD=debug
becomes

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug setup_h CXXFLAGS="-std=gnu++11"
mingw32-make -j2 -f makefile.gcc BUILD=debug CXXFLAGS="-std=gnu++11"
You should decide on C++ standard beforehand, as you need to build all the libraries you use as well as your program with the same standard. Just so you know, "gnu++11" is specific to GCC, you can get strict C++11 standard with "-std=c++11". wxWidgets install.txt for MSW, which you have hopefully read by now, recommends using gnu++11 instead of c++11.

Last but not least, you need to decide on wxWidgets version: latest 3.0.x release, 3.1 release, GIT master... But this one actually is quite important so you need to decide based on the job requirements.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: How do I Compile wxWidgets Sample Code?

Post by ColleenKobe »

YAAAAY!!! I not only got wxWidgets to compile and build, but I am able to compile, build, and run my sample program!!!

Woo hoo!!! Happy day! @PB, @ONEEYEMAN, @stahta01--thank you so much for your help. :D

@PB--thank you for your final post today, with the recommendations about choosing the TDM-32 vs MinGW, how to consistently create builds, and so on. I've spent a good chunk of today writing directions on how to get from downloading wxWidgets all the way to compiling and running a sample program. Tomorrow, I will verify your suggestions work on my computer (not because I doubt them, but for due diligence), and then edit the instructions accordingly.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How do I Compile wxWidgets Sample Code?

Post by ONEEYEMAN »

Colleen,
Keep in mind that if you did modify the sources and you plan to use the modified version you need to make it available on the server somewhere clearly marked so that you, your boss or anyone who come after you will know that you used the modified sources and not the official release.

It is good idea to create your own fork of wxWidgets along with your software on GitHib and then clearly document where to grab everything and how to do the build. Or just save everything on the server and again clearly document everything.

Thank you.
Post Reply