Page 1 of 1

Error while compiling wxWidgets

Posted: Sat Sep 05, 2015 1:16 pm
by SSteven
Hi

I downloaded the wxWidgets source, unzipped it and followed the instructions to compile it, using the following bat file:

ECHO ON
G:
CD %WXWIN%\build\msw

%MINGW%mingw32-make -f makefile.gcc

PAUSE

Note:
1) The wxWidgets source is installed on my G: volume.
2) %WXWIN% environment variable is correctly defined.
3) %MINGW% environment variable points to C:\mingw\bin (the mingw installation directory).
4) Mingw was installed successfully.
5) I am using a 64-bit Windows 10 PC.

After executing the first command successfully, I get the following error and the compilation aborts:

gcc: error: CreateProcess: No such file or directory
makefile.gcc:5702: recipe for target 'gcc_mswud\wxregex_regcomp.o' failed
mingw32-make: *** [gcc_mswud\wxregex_regcomp.o] Error 1

I then searched on this forum for error 5702, and based on some suggestions here on an earlier similar problem, I modified the make command as follows in the bat file:

%MINGW%mingw32-make -f makefile.gcc CPPFLAGS="-m32" LDFLAGS="-m32" WINDRES="windres --use-temp-file -F pe-i386" BUILD=release

This resulted in MinGW error 5657. But if I run the bat file again, error 5702 returns. In both cases, compilation aborts.

Please advise.

Thanks
Steven

Re: Error while compiling wxWidgets

Posted: Sat Sep 05, 2015 2:01 pm
by doublemax
Add the bin folder of your MinGW installation (e.g. C:\MinGW\bin) to your Windows environment PATH variable

Re: Error while compiling wxWidgets

Posted: Sat Sep 05, 2015 9:24 pm
by yasriady
Follow the steps here
http://yasriady.blogspot.co.id/2015/08/ ... mingw.html

and do not forget your mingw's bin folder already in your path.

Re: Error while compiling wxWidgets

Posted: Mon Sep 07, 2015 11:17 am
by SSteven
Yes, adding c:\mingw\bin\ to the PATH variable definition has definitely helped. Thanks for this advice. Compilation proceeds and some output files are generated in the following subdirectories of the wxwidgets unzip folder:

1. build\msw\mswud: Contains several files with .d and .o suffixes.
2. lib\gcc_lib: contains several files with .a suffixes

I'm not sure if any other file types are supposed to be generated. I don't see any DLL files,
though.

The first time I ran the compilation bat file, I had added the DOS command ECHO ON and many messages were generated on the screen. Also, the files mentioned above were generated.

I then removed the ECHO ON command from the bat file and ran it again. This time of course no messages were displayed. Also, no error messages were displayed. The compilation seems to have succeeded. Is there any way I can confirm if this is the case? Is there any need for such a confirmation?

The reason I ask, is that when trying to create a wxwidgets project using the Code::Blocks IDE, the project gets created all right (but with quite a few warning messages from the wizard), but doesn't build later. C::B asks for certain global compiler variables (wx) to be defined and I'm not yet sure to which directories these should point. This may be the cause.

Also, I'm unable to locate the wxwidgets manual on my system. There is no large PDF/CHM/RTF/HTB file anywhere in the wxwidgets unzip folder or its subfolders. Where is this manual supposed to be and what is its name?

Thanks
Steven

Re: Error while compiling wxWidgets

Posted: Mon Sep 07, 2015 11:42 am
by xaviou
Hi
SSteven wrote:1. build\msw\mswud: Contains several files with .d and .o suffixes.
These are temporary build files : once your build is finished, you don't need this folder anymore
SSteven wrote:2. lib\gcc_lib: contains several files with .a suffixes
These are the result of your build.
SSteven wrote:I'm not sure if any other file types are supposed to be generated. I don't see any DLL files, though.
The built files are in a "gcc_lib" folder so you've asked for a static build witch doesn't produce any dll files (all the needed parts of the framework will be inserted in the executable).

If the build process went ok till its end, you should have a file named "build.cfg" in your "lib\gcc_lib\mswu[d]" folder.
As it is the last thing created by the build process, if you have it, all is ok.
SSteven wrote:The reason I ask, is that when trying to create a wxwidgets project using the Code::Blocks IDE, the project gets created all right (but with quite a few warning messages from the wizard), but doesn't build later. C::B asks for certain global compiler variables (wx) to be defined and I'm not yet sure to which directories these should point. This may be the cause.
Be sure that the settings of the project reflect the settings of your build (for example, "use wxWidgets Dll" and "wxWidgets is build as a monolithic library" shouldn't be checked).
SSteven wrote:Also, I'm unable to locate the wxwidgets manual on my system. There is no large PDF/CHM/RTF/HTB file anywhere in the wxwidgets unzip folder or its subfolders. Where is this manual supposed to be and what is its name?
The standard build commands doesn't create the manual.
You should better download this manual from sourceforge : Regards
Xav'

Re: Error while compiling wxWidgets

Posted: Tue Sep 08, 2015 3:37 pm
by SSteven
Yes, the build.cfg file is present in the "lib\gcc_lib\mswud" folder. Thus, the compilation is OK.

Thanks
Steven

Re: Error while compiling wxWidgets

Posted: Tue Oct 17, 2017 11:51 am
by rocrail
Thank, this works fine!
yasriady wrote:Follow the steps here
http://yasriady.blogspot.co.id/2015/08/ ... mingw.html

and do not forget your mingw's bin folder already in your path.
but how to include wxGraphicsContext?

adding USE_GUI=1 to the make command did not do the trick.
Any suggestions?

Re: Error while compiling wxWidgets

Posted: Tue Oct 17, 2017 12:23 pm
by xaviou
Hi
rocrail wrote: but how to include wxGraphicsContext?

adding USE_GUI=1 to the make command did not do the trick.
Any suggestions?
wxGraphicsContext is disabled by default for other compilers than Visual C++.

To enable it you just have to edit the "setup.h" file (in the include/wx/msw subfolder of the wxWidgets sources).
If the file is not present, make a copy of the one named "setup0.h" and name it "setup.h"

In this file, search for wxGraphicsContext.
You should find a section like the following (this is the wx-3.0.2 version of the setup.h file):

Code: Select all

// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is
// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined
#ifdef _MSC_VER
#   if _MSC_VER >= 1310
        // MSVC7.1+ comes with new enough Platform SDK, enable
        // wxGraphicsContext support for it
#       define wxUSE_GRAPHICS_CONTEXT 1
#   else
        // MSVC 6 didn't include GDI+ headers so disable by default, enable it
        // here if you use MSVC 6 with a newer SDK
#       define wxUSE_GRAPHICS_CONTEXT 0
#   endif
#else
    // Disable support for other Windows compilers, enable it if your compiler
    // comes with new enough SDK or you installed the headers manually.
    //
    // Notice that this will be set by configure under non-Windows platforms
    // anyhow so the value there is not important.
#   define wxUSE_GRAPHICS_CONTEXT 0
#endif
Replace the last # define wxUSE_GRAPHICS_CONTEXT 0 by # define wxUSE_GRAPHICS_CONTEXT 1
Save and re-launch the build process and wxGraphicsContext should be enabled.

Regards
Xav'

Re: Error while compiling wxWidgets

Posted: Tue Oct 17, 2017 12:53 pm
by rocrail
Thanks!
I will try it and report.

Re: Error while compiling wxWidgets

Posted: Tue Oct 17, 2017 8:03 pm
by rocrail
Thanks again.

This worked.
But I also had to change it in

Code: Select all

lib\gcc_lib\mswu\wx\setup.h
after the build.

Re: Error while compiling wxWidgets

Posted: Wed Oct 18, 2017 6:54 am
by xaviou
rocrail wrote:Thanks again.

This worked.
But I also had to change it in

Code: Select all

lib\gcc_lib\mswu\wx\setup.h
after the build.
Because you didn't made a clean build : this file is copied the first time you launch the build.

But in a "normal" way, I think you should have edited it before the build.

Regards
Xav'

Re: Error while compiling wxWidgets

Posted: Sun Nov 19, 2017 6:15 pm
by rocrail
Hi,

Code: Select all

mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 CXXFLAGS="-std=gnu++11"
this method will also work for 64 bit? (tdm64-gcc-5.1.0-2.exe)
Or should the CXXFLAGS set another value?

Re: Error while compiling wxWidgets

Posted: Mon Nov 20, 2017 2:17 pm
by rocrail
OK, it works also for 64 bit.