Building wxWidgets with MinGW

Pages: 1234
Oct 17, 2012 at 10:14pm
alright, I did it and here is what it spit out:

$ cd "C:\Program Files\CodeBlocks\wxWidgets-2.8.12\build\msw"

username@username-PC /c/Program Files/CodeBlocks/wxWidgets-2.8.12/build/msw
$ make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
if not exist gcc_mswudll mkdir gcc_mswudll
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

c:\Program Files\CodeBlocks\wxWidgets-2.8.12\build\msw>


It took not even a second. And then it switched to command prompt. I will test to see if it built by compiling a test program.

it didn't work..... :(
Last edited on Oct 17, 2012 at 10:15pm
Oct 17, 2012 at 10:36pm
Delete all the files in
c:\Program Files\CodeBlocks\wxWidgets-2.8.12\build\msw\gcc_mswudll\
and run it again.
Oct 17, 2012 at 10:41pm
....... There is no folder with that name...
Oct 18, 2012 at 12:21am
I had this problem too and it took months to fix as I couldn't get a straight answer. This is what I did in the end.

I would also set up MingW or if it's in CodeBlocks set up code::blocks in a simple directory path like C:\MinGW or C:\CodeBlocks\MinGW .

1 - set the 'Path' environmental varialbe to the bin folder in your mingw bin directory. (There are plenty of instructions on the web for this)
You will already see the 'Path' variable set to a few other directory paths. You simple add a ; to the end of them and paste in the MinGW bin folder path. eg in mine it was C:\CodeBlocks\MinGW\bin ... Thats it.

2 - Open the command prompt, change the directory to the wxWidgets directory. Put the wxWidgets directory somewhere like C:\wxWidgets, I believe if the path has spaces between the directory names then it can cause an issue. Not sure why so jut keep it simple.

Changing the directory is simple. In my case it was
cd C:\wxWidgets Thats it.


3 - enter the below two lines seperately. First build the debug version and then the release version. I've set Shared = 0 below as I don't want to use a dll. I gather you want to statically link your projects. The below works


mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=release

mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug

******Thats it, now wxWidgets has been build you can start on creating a new project******

The steps below explain how to not get an error when doing that. The settings in Code::Blocks which is what I'm using correspond to the
Shared, Unicode, Monolithic settings above.

When you go to create a new project for the first time (if you are using Code::Blocks, the above settings will need to correspond to the settings in your project or you will keep getting errors.

eg.. in the WXWidgets library settings you tick
wxWidgets is built as monolithic (because you have set Monolithic = 1 above)

Enable unicode
(because you have set Unicode = 1 above)

Create and use a precompiled header (tick this)

I also ticked, 'Configure advanced options' and it works fine.

All other options should be unticked. That is 'Use wxWidgets DLL' because you set Shared = 0 above.

I realize this is not very technically worded but I'm trying to give you what I have done so you don't have to go through the months of hell to get this working that I did.
Hope this helps.

Last edited on Oct 18, 2012 at 12:49am
Oct 18, 2012 at 4:16am
@dominover

Thank you so much! I will try that and post what happens.
Oct 18, 2012 at 6:40am
Just one correction on my above.. My apologies, made a mistake.

When changing the directory in the command line the correct setting is

C:\wxWidgets-2.8.12\build // obviously it's the build directory in the wxWidgets directory.

Oct 18, 2012 at 5:12pm
Username@USERNAME-PC /c/CodeBlocks/wxWidgets-2.8.12/build
$ mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
sh: mingw32-make: command not found


Copied and pasted from the MSYS command line... did you want me to use make?

This is what I get when I used make:

USERNAME@Username-PC /c/CodeBlocks/wxWidgets-2.8.12/build
$ make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
make: makefile.gcc: No such file or directory
make: *** No rule to make target `makefile.gcc'. Stop.


In Build/msw, mingw32-make acts as though I didn't type a word in. Using make returns the following, and switches into command prompt:

Username@USERNAME-PC /c/CodeBlocks/wxWidgets-2.8.12/build/msw
$ make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
if not exist gcc_mswud mkdir gcc_mswud
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.


Note that these actions are taken immediately after the command is entered.

It also fails to create the directory gcc_mswud... this is starting to become such an insufferable task.

Last edited on Oct 18, 2012 at 5:22pm
Oct 18, 2012 at 6:38pm
wxwidgets does not need MSYS to build/link correctly in windows ! If you insist to use MSYS, then read about building wxwidgets in *nix environments using ./configure options (that's right !).


I always use latest port of GCC on windows, but this is NOT required:
http://tdm-gcc.tdragon.net/

Download and install wxwidgets installer from http://wxwidgets.org/

Then just run mingw32-make -f makefile.gcc from %WXWIN%\build\msw directory. You can edit config.gcc before doing this step. Make sure that bin directory of your directory is in %PATH%. (TDM installation setup this for you automatically)
Oct 19, 2012 at 12:53am
No, not MSYS in this case. I understand why you might thing that considering 99.9% of people on any forum in the world will give you a command prompt to input and it will be for MSYS but nobody will even mention MSYS.

In this case it's just plain old Windows CMD promt.

Enter the full Debug and Release commands I've given you above.
Last edited on Oct 19, 2012 at 1:48am
Oct 19, 2012 at 4:05pm
Ah, that changes things. No one told me (after telling me to use MSYS) that I was supposed to use command prompt. I will start now.

C:\CodeBlocks\wxWidgets-2.8.12\build\msw>mingw32-make -f makefile.gcc SHARED=0 U
NICODE=1 MONOLITHIC=1 BUILD=debug
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.


Command prompt. It did the same in widgets\build.

EDIT1: I just noticed somthing: mingw32-make in my msw directory appears empty. I don't know why, but it is. 0kb. Could this have somthing to do with my problems? If so, where can i download it seperately?
Last edited on Oct 19, 2012 at 4:10pm
Oct 19, 2012 at 5:34pm
In Build/msw, mingw32-make acts as though I didn't type a word in. Using make returns the following, and switches into command prompt:

Username@USERNAME-PC /c/CodeBlocks/wxWidgets-2.8.12/build/msw
$ make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
if not exist gcc_mswud mkdir gcc_mswud
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.


Can you check if that folder does exist? If it does delete everything in it and run the command again.

IIRC you using nuwen mingw ( http://nuwen.net/mingw.html )? If so, I dont think it has mingw-make (at least my copy doesn't) but does include make. At this point, if the previous suggestion didn't work, I'd suggest installing a fresh copy of both mingw (nuwen is using gcc-4.7.2 now) and wxWidgets.
Oct 19, 2012 at 7:52pm
Alright, I'm just going to re-install everything. Do I need MSYS yes or no?

I will be building 2 libraries: BOOST and wxWidgets.
Last edited on Oct 19, 2012 at 7:55pm
Oct 19, 2012 at 8:05pm
I dont think you need to build boost with the nuwen mingw but I'm not certain. Try without msys first, I was able to build without it.
Oct 19, 2012 at 10:58pm
You don't need MSYS.. I didn't even know what MSYS was when I build wxWidgets with Mingw.
Oct 20, 2012 at 7:13am
MSYS is only needed if you want to build libraries that does not really have a windows port and can only be build by a ./configure script (neither wxwidgets or boost require MSYS).
Oct 20, 2012 at 9:10pm
Should I put Boost in C:\Program Files?

Alright, so I started following some instructions:

http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef#Build_Boost

And that's for version 1.47.0, but I have version 1.51.0. Are thos instructions good? I have already foung no folder named boost-jam-3.1.18-1-ntx86, so I want to make sure that these instructions can be used on the latest version.
Last edited on Oct 20, 2012 at 9:39pm
Oct 20, 2012 at 9:54pm
So, heres what I get when I trey to build wxWidgets:

1
2
3
4
5
6
7
8
C:\wxWidgets-2.8.12\build\msw>mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MO
NOLITHIC=1 BUILD=debug
if not exist gcc_mswud mkdir gcc_mswud
gcc -c -o gcc_mswud\wxregex_regcomp.o -g -O0 -mthreads  -DHAVE_W32API_H -I..\..\
include -I..\..\lib\gcc_lib\mswud -D__WXMSW__  -D_UNICODE   -MTgcc_mswud\wxregex
_regcomp.o -MFgcc_mswud\wxregex_regcomp.o.d -MD -MP ../../src/regex/regcomp.c
gcc: CreateProcess: No such file or directory
mingw32-make: *** [gcc_mswud\wxregex_regcomp.o] Error 1


Any suggestions? I added that environment variable end everything... I completely re-installed Code::Blocks/MinGW and wxWidgets before doing this!
Oct 20, 2012 at 10:41pm
Can you check the makefile.gcc in the msw folder. Is the first letter in uppper case such as Makefile.gcc as opposed to makefile.gcc . That will cause an error if the case is wrong.

Try that.
Oct 21, 2012 at 4:07pm
Nothing wrong with makefile.gcc.....

this is what my environmental variables look like:

C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Nmap;C:\CodeBlocks\MinGW\bin;


Directories:

wxWidgets: C:\wxWidgets-2.8.12
CodeBlocks: C:\CodeBlocks
MinGW: C:\CodeBlocks\MinGW

Edit1: I just noticed somthing: There is a slash after each directory in environmental variables i didnt notice before, and didnt add to the end of mingw's. I will add that and try.

EDIT2: never mind.... I still get the same error.
Last edited on Oct 21, 2012 at 5:11pm
Oct 21, 2012 at 5:22pm
ok. I'm so fucking sick of these dumb instructions on how to "build" boost:

Ensure that Boost Jam is in the PATH environment variable (where <path> is the path you unpacked Boost Jam to):

set PATH=<path>\boost-jam-3.1.18-1-ntx86;%PATH%


Sorry to burst your bubble, but not even in version 1.47 is there any boost-jam-3.1.18-1-ntx86. I did a file search and you know what I found? NOTHING! Could someone please give me correct instructions (or link, or anything, just as long AS IT WORKS) before i punch a hole through my computer's screen. This is driving me crazy, and it's supposed to be the instructions to set this up with codeblocks. Obviously not. I downgraded just to follow the instructions and it still doesnt work. I even used my search program (searches every file and directory even hidden/locked, etc....) and didnt find it.

Please if you can help me I would be so greatful!
Last edited on Oct 21, 2012 at 5:30pm
Pages: 1234