Installing in Code::Blocks with MinGW and no MSYS or CYGWIN

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.
jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Fri Apr 24, 2009 2:46 pm

For anybody that wants it, I made a little batch file that simplifies this process. That way if I need to "redo" the compile I don't have to worry about opening a command prompt, remember where and what config options I needed, etc. etc.

The third line of the batch file needs to be adjusted so that it points to you widgets library build/msw directory. Example: I unzipped wxWidgets 2.8.10 into

Code: Select all

c:\dev\wx\wxWidgets-2.8.10
so my third line says

Code: Select all

pushd c:\dev\wx\wxWidgets-2.8.10\build\msw
You'll need to just change that third line of this batch script and it seems to all work fine. OH! And make sure that mingw is in your path. So yes, this script assumes you have mingw installed and in your path, and wxWidgets downloaded (I prefer the zip file, but to each his own) and in a known location. You'll need that location for the third line of this script.

myWxMake.bat

Code: Select all

@echo off
SETLOCAL
pushd C:\dev\wx\wxWidgets-2.8.10\build\msw

cls
echo.
echo -----------------------------------------------------------------------------------
echo wxWidgets Win32/MinGW Helper build script
echo      Author:   John A. Mason
echo      Date:     04/24/2009
echo      Release:  For anyone to use/copy/manipulate/learn. Hope it helps.
echo -----------------------------------------------------------------------------------
echo.
echo.
echo This script will ask a series of questions to figure out which build you wish to
echo construct. There are many ways, depending on your needs, to build the wxWidgets
echo library. 
echo.
echo The defaults have been setup so that you can build the standard build of wxWidgets.
echo Leaving every question blank and just pressing enter will fill in the 
echo standard [default] options.
echo.
echo.
echo Let's begin.
echo.
echo -----------------------------------------------------------------------------------
pause
cls
echo.
echo The developers of wxWidgets did a great thing starting with version 2.5 
echo in reducing the footprint of the requirements for a wxWidgets application
echo by splitting the giant library into smaller library files. However, this has
echo led to some developers having trouble figuring out which library files they
echo must link to. This script can still build the giant monolithic library if you
echo wish. However, the new default is to build the multilib version (of many,
echo smaller, individual library files).
echo.
echo Would you like to build the libraries as Monolithic library (y/n)? [no]
set /p myMONOLITHIC=
cls
echo.
echo Depending on the needs of your application and the platform requirements, 
echo you may wish to build this library as a unicode library. It does require to use
echo of the wxT() macro or _T() macro when defining any and all string literals in 
echo all of your application code, however.
echo.
echo Would you like build Unicode libraries (y/n)? [yes]
set /p myUNICODE=
cls
echo.
echo This script can help you build both the static and shared libraries of wxWidgets,
echo or it can be told to only build the shared or only the static.
echo.
echo Leaving the next two prompts at the default is recommended unless you are building
echo a special build that requires you to build the shared libraries separately from
echo the static. E.g. using RUNTIME_LIBS=static cannot be used when building the shared
echo libraries. In that case, you would first build the shared libraries without 
echo RUNTIME_LIBS=static. Then you would build the static libraries with the option added.
echo.
echo Would you like to build static libraries (y/n)? [yes]
set /p mySTATIC=
echo Would you like to build shared libraries (y/n)? [yes]
set /p mySHARED=
cls
echo.
echo The vendor name determines the appended name on shared dll files. If you are company
echo ABC, you might want your dll files to be wxbase28u_core_abc.dll to identify that
echo your company provided them as part of your application. Since this is considered a
echo custom build, the default is to add custom to all dll files.
echo.
echo What vendor name for your custom dll files? [custom]
set /p myVENDOR=
cls
echo.
echo All object files are stored in a directory under build\msw, depending on build settings,
echo compiler name, and the CFG setting. Examples of directory names:
echo.
echo   build\msw\bcc_msw            SHARED=0
echo   build\msw\bcc_mswdll         SHARED=1
echo   build\msw\bcc_mswunivd       SHARED=0, WXUNIV=1, BUILD=debug
echo   build\msw\vc_mswunivd        ditto, with Visual C++
echo.
echo Libraries and DLLs are stored in a directory structure similar, along with the setup.h
echo that matches the build configuration. Examples:
echo with name that contains other settings:
echo.
echo   lib\bcc_msw
echo   lib\bcc_lib\msw\wx\setup.h
echo   lib\bcc_dll
echo   lib\bcc_dll\msw\wx\setup.h
echo   lib\bcc_lib
echo   lib\bcc_lib\mswunivd\wx\setup.h
echo   lib\vc_lib
echo   lib\vc_lib\mswunivd\wx\setup.h
echo.
pause
cls
echo If you set CFG to something, the value is appended to directory names. Thus, if you set CFG you
echo will need to change your linker command to reflect the changed directory names. E.g.
echo for CFG=MyBuild, you'll have object files in
echo.
echo   build\msw\bcc_mswMyBuild
echo   build\msw\bcc_mswdllMyBuild
echo   etc.
echo.
echo and libraries in
echo.
echo   lib\bcc_libMyBuild
echo   lib\bcc_dllMyBuild
echo   etc.
echo.
echo The purpose of this is to allow for multiple builds with multiple setups that don't conflict.
echo So if you want to build both the monolithic AND the multilib version, set CFG to something
echo different for each build or else the latter build will overwrite the first build.
echo.
echo Would you like to set the CFG of this build? [(empty)]
set /p myCUSTOM=
cls
echo.
echo Reading the INSTALL-MSW.txt file will provide other options that can be used for building.
echo Examples include:
echo.
echo   MSLU=1
echo   RUNTIME_LIBS=static
echo   WXUNIV=1
echo   etc.
echo  * NOTE: Be sure to read the INSTALL-MSW.txt file for important information. For instance, 
echo          adding RUNTIME_LIBS=static along side of the SHARED=1 will cause issues!
echo.
echo Would you like to set any other options for this build? [(empty)]
set /p myOTHER=
cls

if "%myMONOLITHIC%" == "" set myMONOLITHIC=no
if "%myUNICODE%" == "" set myUNICODE=yes
if "%mySTATIC%" == "" set mySTATIC=yes
if "%mySHARED%" == "" set mySHARED=yes
if "%myVENDOR%" == "" set myVENDOR=custom
if "%myCUSTOM%" == "" set myCUSTOM=
if "%myOTHER%" == "" set myOTHER=

echo.
echo -----------------------------------------------------------------------------------
echo.
echo Configuration complete:
echo.
echo   Build Monolithic:      %myMONOLITHIC%
echo   Build Unicode:         %myUNICODE%
echo   Build Static libs:     %mySTATIC%
echo   Build Shared libs:     %mySHARED%
echo   Vendor Label:          %myVENDOR%
echo   Custom Build dir:      %myCUSTOM%
echo   Other Build options:   %myOTHER%
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Please confirm:
echo.
echo Is this correct? (y/n) [y]
set /p myConfirm=

if "%myConfirm%" == "" set myConfirm=yes
if "%myConfirm%" == "n" GOTO END
if "%myConfirm%" == "0" GOTO END
if "%myConfirm%" == "no" GOTO END

cls
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Beginning Build Process...
echo.
echo.

if "%myMONOLITHIC%" == "n" GOTO SKIPMONO
if "%myMONOLITHIC%" == "0" GOTO SKIPMONO
if "%myMONOLITHIC%" == "no" GOTO SKIPMONO
if "%myUNICODE%" == "n" GOTO SKIPUNICODEMONO
if "%myUNICODE%" == "0" GOTO SKIPUNICODEMONO
if "%myUNICODE%" == "no" GOTO SKIPUNICODEMONO

if "%mySTATIC%" == "n" GOTO SKIPSTATICA
if "%mySTATIC%" == "0" GOTO SKIPSTATICA
if "%mySTATIC%" == "no" GOTO SKIPSTATICA
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MONOLITHIC UNICODE STATIC
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
:SKIPSTATICA

if "%mySHARED%" == "n" GOTO END
if "%mySHARED%" == "0" GOTO END
if "%mySHARED%" == "no" GOTO END
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MONOLITHIC UNICODE SHARED
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=1 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
GOTO END

:SKIPUNICODEMONO
if "%mySTATIC%" == "n" GOTO SKIPSTATICB
if "%mySTATIC%" == "0" GOTO SKIPSTATICB
if "%mySTATIC%" == "no" GOTO SKIPSTATICB
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MONOLITHIC STATIC
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
:SKIPSTATICB

if "%mySHARED%" == "n" GOTO END
if "%mySHARED%" == "0" GOTO END
if "%mySHARED%" == "no" GOTO END
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MONOLITHIC SHARED
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=0 MONOLITHIC=1 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
GOTO END

:SKIPMONO
if "%myUNICODE%" == "n" GOTO SKIPUNICODE
if "%myUNICODE%" == "0" GOTO SKIPUNICODE
if "%myUNICODE%" == "no" GOTO SKIPUNICODE

if "%mySTATIC%" == "n" GOTO SKIPSTATICC
if "%mySTATIC%" == "0" GOTO SKIPSTATICC
if "%mySTATIC%" == "no" GOTO SKIPSTATICC
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MULTILIB UNICODE STATIC
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
:SKIPSTATICC

if "%mySHARED%" == "n" GOTO END
if "%mySHARED%" == "0" GOTO END
if "%mySHARED%" == "no" GOTO END
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MULTILIB UNICODE SHARED
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=1 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
GOTO END

:SKIPUNICODE

if "%mySTATIC%" == "n" GOTO SKIPSTATICD
if "%mySTATIC%" == "0" GOTO SKIPSTATICD
if "%mySTATIC%" == "no" GOTO SKIPSTATICD
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MULTILIB STATIC
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=debug UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=0 BUILD=release UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
:SKIPSTATICD

if "%mySHARED%" == "n" GOTO END
if "%mySHARED%" == "0" GOTO END
if "%mySHARED%" == "no" GOTO END
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Building: MULTILIB SHARED
echo.
echo -----------------------------------------------------------------------------------
echo.
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=debug UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" clean
mingw32-make -f makefile.gcc %myOTHER% SHARED=1 BUILD=release UNICODE=0 MONOLITHIC=0 CFG="%myCUSTOM%" VENDOR="%myVENDOR%" 


echo -----------------------------------------------------------------------------------
echo.
echo Building: COMPLETE
echo.
echo Hope this helped you.
echo.
echo -----------------------------------------------------------------------------------
echo.

:END
set myUNICODE=
set myMONOLITHIC=
set myVENDOR=
set myCUSTOM=
set myOTHER=
set myConfirm=
popd
ENDLOCAL

Hope this helps someone.

And FYI, windows users/developers aren't dumb. It's just that some people don't understand how to build a library when they start out, and let's face it. Lots of people have windows, use windows, and so they try to learn on windows. The point of this script is to help people like that. Hey, back in the Windows 3.1 days I was one of those people! Sure, I was in the 5th grade, but I was still trying to teach myself how to program C/C++ on windows! So go for it you windows noobies! And good luck.
Attachments
mymake.zip
A batch file for building wxWidgets libraries with MinGW on windows.
(2.73 KiB) Downloaded 79 times
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

same here with some differences

Post by Meta » Thu Sep 17, 2009 10:34 am

Hello Everyone,

i am just another Person with exactly the same problem as described in the Entry Post, with 1 main difference:

I have neither a reference for Cygwin/bin in PATH nor one for MSYS.

I have MSYS 1.0 installed (the errors occured even before)
and I got a build of wxWidgets using MSYS (but that one does not work with my IDE, see below).


I use Code::Blocks as the Thread Intender an MinGW 5.1.4.
OS: Windows XP


I am looking forward to reading you soon!

PS: My cyrillic is even to Zero, hence I could not find the Tutorial Vid.

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

More info needed

Post by jmason1182 » Thu Sep 17, 2009 1:40 pm

Need more info to help you.
I have neither a reference for Cygwin/bin in PATH nor one for MSYS.
You don't need either Cygwin OR MSYS for the batch file I gave.
I have MSYS, but I don't use it to build. I do not have Cygwin installed at all.
I have MSYS 1.0 installed (the errors occured even before)
and I got a build of wxWidgets using MSYS (but that one does not work with my IDE, see below).
You built wxWidgets using MSYS? Not possible. MSYS is... well basically a shell. the MingW compiler is all you need to compile the build. You need to either have MingW in your PATH or edit every line that starts with "mingw-make" to the full path and filename. I would suggest just putting the MingW bin directory in your path to simplify things.

And what do you mean it doesn't work with your IDE? wxWidgets is a library. so once you compile the library, you essentially "plug" it into your code so your code can access the resources in the library. Your IDE is just going to help you will that "plug" part - your linker needs to have the path to the built library files unless you are doing a dll. Your compiler needs the path to your wxwidgets source, etc.
I use Code::Blocks as the Thread Intender an MinGW 5.1.4.
OS: Windows XP
I'm not sure what Thred Intender means, but I use Code::Blocks exclusively because I can get it to do anything I need it to. If you are having trouble getting Code::Blocks to compile things with the library (not the library itself) then you might want to go see the tutorials and forums on the code::blocks site for immediate assistance. My configuration is very difficult to explain because I'm so tightly intwined with wxwidgets.
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

Post by Meta » Thu Sep 17, 2009 7:05 pm

You don't need either Cygwin OR MSYS for the batch file I gave.
I haven't tried your batch file yet.
I do not have Cygwin installed at all.


Dito.
You built wxWidgets using MSYS? Not possible.
Partial true. In fact...it IS possible, in conjunction with minGW.
I would suggest just putting the MingW bin directory in your path to simplify things.
I did..

And what do you mean it doesn't work with your IDE?
See.. I copy the code of an example by wxwidgets.org. Then I
set up the include path, then I set up the path of the libraries to my build (!!!). Next, I insert the libraries used in the Linker Settings. As far as I see, you are using C::B too, so you should be able to follow this.
Compiling the code produces undefined references.
This is what I meant with
but that one does not work with my IDE
.


I hope that things are more clear now.

---------------------------------------------------------

Thus far.. after that failed MSYS try, I used

the same minGW32-make line method as the TI described in the first post (and told by various tutorials).
But I get exactly the same errors.

This is why I post in here.

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Thu Sep 17, 2009 10:00 pm

OK, I see... well.. partially. Semantics aside (saying you built with MSYS is like saying I built with DOS, or maybe I built with Bash... no you didn't. You used a compiler and ran it FROM that shell, but you didn't compile a darned thing with the shell itself... but again, that's semantics and we can get past that now.)

Anyway, I digress... Where was I? Oh yeah... So let's start from the beginning of the process and I'll at least help you help us to help you with your problem.

1) Have you built the libraries yet? I ask because some people don't know that you have to build the libraries first before you can use them. If you haven't, then that's where we need to start.

2) If you have then let's look at the exact situation. What example are you using and just how exactly are you setting up the path to the libraries? Are you using any C::B variables? Are you using full paths, relative paths, etc. and are you including extensions when you add the libraries in the linker settings, etc.??

Perhaps a full list of the actual errors themselves will help to further understand where in the process you are.
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

Post by Meta » Fri Sep 18, 2009 10:49 am

1.) :
Yes I know,but concerning my problem, lets say NO I didn't. Let's start here.

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Fri Sep 18, 2009 1:24 pm

OK, that helps. First off we need to build the library.

The purpose of my batch file is to help at least know what options and what steps are needed to build the library. Even if you don't want to run the batch file itself, you can pick an individual command to help with the options for what you want.

So now that we know mingw is in the PATH, let's just get started.

First off, let me quote the first parts of the batch file to explain some options.

The developers of wxWidgets did a great thing starting with version 2.5 in reducing the footprint of the requirements for a wxWidgets application by splitting the giant library into smaller library files. However, this has led to some developers having trouble figuring out which library files they must link to. This script can still build the giant monolithic library if you wish. However, the new default is to build the multilib version (of many, smaller, individual library files).

IF you want to build the libraries as the old-single BIG library file, use the option MONOLITHIC=1

Depending on the needs of your application and the platform requirements, you may wish to build this library as a unicode library. It does require to use of the wxT() macro or _T() macro when defining any and all string literals in all of your application code, however. IF you want to build the libraries with unicode support, use UNICODE=1

You can build the library as shared (DLL files) or as static library files (.a or .so type) In addition, you can use RUNTIME_LIBS=static to use the static versions of the common runtime files (in simple terms that meansit won't require any windows dll files to be present...) But you can't use RUNTIME_LIBS=static if you are building shared libraries (SHARED=1)

The vendor name determines the appended name on shared dll files. If you are company ABC, you might want your dll files to be wxbase28u_core_abc.dll to identify that your company provided them as part of your application. Since this is considered a custom build, the default is to add custom to all dll files.

All object files are stored in a directory under build\msw, depending on build settings, compiler name, and the CFG setting. Examples of directory names:

build\msw\bcc_msw SHARED=0
build\msw\bcc_mswdll SHARED=1
build\msw\bcc_mswunivd SHARED=0, WXUNIV=1, BUILD=debug
build\msw\vc_mswunivd ditto, with Visual C++

Libraries and DLLs are stored in a directory structure similar, along with the setup.h that matches the build configuration. Examples:

lib\bcc_msw
lib\bcc_lib\msw\wx\setup.h
lib\bcc_dll
lib\bcc_dll\msw\wx\setup.h
lib\bcc_lib
lib\bcc_lib\mswunivd\wx\setup.h
lib\vc_lib
lib\vc_lib\mswunivd\wx\setup.h

If you set CFG to something, the value is appended to directory names. Thus, if you set CFG you will need to change your linker command to reflect the changed directory names. Example:
for CFG=MyBuild, you'll have object files in

build\msw\bcc_mswMyBuild
build\msw\bcc_mswdllMyBuild
etc.

and libraries in

lib\bcc_libMyBuild
lib\bcc_dllMyBuild
etc.

The purpose of this is to allow for multiple builds with multiple setups that don't conflict. So if you want to build both the monolithic AND the multilib version, set CFG to something different for each build or else the latter build will overwrite the first build.

Reading the INSTALL-MSW.txt file will provide other options that can be used for building.
Examples include:

MSLU=1
RUNTIME_LIBS=static
WXUNIV=1
etc.

* NOTE: Be sure to read the INSTALL-MSW.txt file for important information. For instance,
adding RUNTIME_LIBS=static along side of the SHARED=1 will cause issues!
That seems like a lot, but it really matters how you build the libraries.

Now the next thing to get straight is where can we find wxWidgets, for me I unpacked wxWidgets in c:\dev\wx\wxWidgets-2.8.10

So the makefiles for me will be found in C:\dev\wx\wxWidgets-2.8.10\build\msw

ON TO BUILDING THE LIBRARIES
So let's do it. Go into your makefile directory (in my case, c:\dev\wx\wxWidgets-2.8.10\build\msw). From this directory, run the following command:

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="" VENDOR="" clean
mingw32-make -f makefile.gcc SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="" VENDOR=""
Notice:
The options I just specified will make a static, debug build with unicode support. It'll be a monolithic library, and not individual library files for each part of wxWidgets. There won't be any appended text after the name of the libary (VENDOR is set to nothing) and there won't by anything appended after a directory name (CFG is set to nothing). This means that any other builds I run will probably overwrite this one.

Also notice I did all the options and then "clean" first before running the build. That's because each part of the build will create separate directories. So to clean up any previous builds and build it fresh, we'll need to clean up the object directories that are specific to the build we are about to do.


Let's start with that. It's alot of info and I'm sure you may have some questions. From here on in, if you try it and it doesn't work, post the command you ran, the errors that showed up, and any other info you can so we can help you further.
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

Post by Meta » Mon Sep 21, 2009 10:57 am

Running

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="" VENDOR="" clean
caused the following errors:

Code: Select all

Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\wxmsw28ud_aui_gcc_.dll del ..\..\lib\gcc_lib\wxmsw28ud_aui_gcc_.dll
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\libwxmsw28ud_aui.a del ..\..\lib\gcc_lib\libwxmsw28ud_aui.a
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\libwxmsw28ud_aui.a del ..\..\lib\gcc_lib\libwxmsw28ud_aui.a
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\wxmsw28ud_richtext_gcc_.dll del ..\..\lib\gcc_lib\wxmsw28ud_richtext_gcc_.dll
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\libwxmsw28ud_richtext.a del ..\..\lib\gcc_lib\libwxmsw28ud_richtext.a
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\libwxmsw28ud_richtext.a del ..\..\lib\gcc_lib\libwxmsw28ud_richtext.a
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\wxmsw28ud_gl_gcc_.dll del ..\..\lib\gcc_lib\wxmsw28ud_gl_gcc_.dll
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\libwxmsw28ud_gl.a del ..\..\lib\gcc_lib\libwxmsw28ud_gl.a
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
if exist ..\..\lib\gcc_lib\libwxmsw28ud_gl.a del ..\..\lib\gcc_lib\libwxmsw28ud_gl.a
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [clean] Error 1 (ignored)
mingw32-make -C ..\..\samples -f makefile.gcc LINK_DLL_FLAGS="-shared" LINK_MODULE_FLAGS="-shared" CC="gcc" CX
X="g++" CFLAGS="" CXXFLAGS="" CPPFLAGS="" LDFLAGS="" CPP="gcc -E" SHARED="0" WXUNIV="0" UNICODE="1" MSLU="0" B
UILD="debug" DEBUG_INFO="default" DEBUG_FLAG="default" MONOLITHIC="1" USE_GUI="1" USE_HTML="1" USE_MEDIA="1" U
SE_XRC="1" USE_AUI="1" USE_RICHTEXT="1" USE_OPENGL="0" USE_ODBC="0" USE_QA="0" USE_EXCEPTIONS="1" USE_RTTI="1"
 USE_THREADS="1" USE_GDIPLUS="0" OFFICIAL_BUILD="0" VENDOR="" WX_FLAVOUR="" WX_LIB_FLAVOUR="" CFG="" CPPUNIT_C
FLAGS="" CPPUNIT_LIBS="" RUNTIME_LIBS="dynamic" GCC_VERSION="3" clean
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: *** [clean] Error 1
If you need translations for better understanding, i will hand them in later.

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Mon Sep 21, 2009 2:35 pm

Two things... one I'll use Google Translate to translate it so you don't have to worry about it.

Secondly, if you haven't built it yet then there isn't anything to clean. I gave you the clean command first to make sure we were starting fresh. (You only need to use the word 'clean' after a successful build has taken place. What it does is allow you to make big changes to the setup and/or build itself and ensure that everything is rebuilt from scratch when you rebuild it. You haven't built it yet, thus, you don't need to re-build it.) I should've given better instructions, sorry.

So go ahead and repeat without that last "clean" step to and then send me what you get.
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

Post by Meta » Mon Sep 21, 2009 4:26 pm

Alright, no problem, let's go ahead with

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="" VENDOR=""
This results in this:

Code: Select all

C:\Programmierung\cpp_libs\wxWidgets-2.8.10\build\msw>mingw32-make -f makefile.gcc SHARED=0 BUILD=debug UNICOD
E=1 MONOLITHIC=1 CFG="" VENDOR=""
if not exist gcc_mswud mkdir gcc_mswud
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: [gcc_mswud] Error 1 (ignored)
if not exist ..\..\lib\gcc_lib mkdir ..\..\lib\gcc_lib
Der Befehl "C:\DOKUME~1\FLO" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: *** [..\..\lib\gcc_lib] Error 1

C:\Programmierung\cpp_libs\wxWidgets-2.8.10\build\msw>

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Mon Sep 21, 2009 4:43 pm

OK...

Code: Select all

C:\Programming\cpp_libs\wxWidgets-2.8.10\build\msw> mingw32-make-f makefile.gcc SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="" VENDOR=""
gcc_mswud if not exist mkdir gcc_mswud
The command "C:\PROGRA~1\FLO" is either misspelled or could not be found.
mingw32-make: [gcc_mswud] Error 1 (ignored)
if not exist ..\..\lib\gcc_lib mkdir ..\..\lib\gcc_lib
The command "C:\PROGRA~1\FLO" is either misspelled or could  not be found.
mingw32-make: *** [..\..\lib\gcc_lib] Error 1 C:\Programming\cpp_libs\wxWidgets-2.8.10\build\msw> 
This tells me something isn't right with.... something environment wise. The same issue is quoted above when we were doing the clean statement. I guess I need to know what your PATH environment variable looks like. Also, are you building in MSYS or in the winXP native command line interface? Also, where is mingw installed so I can check it against your path?

In other words, the error you are getting right now is that it can't find something... and my guess is that the PATH environment variable isn't pointing exactly to the mingw32-make command, or perhaps the mingw32-make command is setup to explicitly call the gcc and it doesn't have the right path. SOMEWHERE it is calling a path that doesn't exist and from the looks of it the culprit is located in C:\Program Files somewhere.
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

Post by Meta » Tue Sep 22, 2009 9:40 am

I see, so lets check my Path and my Install Directory for minGW.
I am using the native winXP Command Line Interface.

My Path:

Code: Select all

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Programme\TortoiseSVN\bin;C:\MinGW\bin;C:\MingGW\mingw32\bin;C:\Programme\doxygen\bin;C:\Python26
and my install directory:

Code: Select all

C:\MinGW
---

As an additional hint, i am able to execute
mingw32-make --version
without an error.

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Tue Sep 22, 2009 4:44 pm

Wow.

OK... let's see. so your path looks ok. mingw32-make works. I just took a look at the typical makefile.gcc and it doesn't reference a path like that. Neither does config.gcc (included from makefile).

Are you using MSYS or are in the command prompt?
John A. Mason
Midland, TX

Meta
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Sep 17, 2009 10:25 am

Post by Meta » Tue Sep 22, 2009 6:59 pm

I am using the WinXP native command prompt.

jmason1182
Earned some good credits
Earned some good credits
Posts: 149
Joined: Fri Dec 14, 2007 3:40 pm
Location: Midland, TX
Contact:

Post by jmason1182 » Wed Sep 23, 2009 2:16 pm

Let's try something wild and crazy.

Run this, then upload the output.txt file that results.

Code: Select all

mingw32-make -n -f makefile.gcc SHARED=0 BUILD=debug UNICODE=1 MONOLITHIC=1 CFG="" VENDOR="" > output.txt
If that is shorter than say, 20 or so lines, then add the '-d' parameter as well as the '-n' so we can have the full debugging output (which is huge!)
John A. Mason
Midland, TX

Post Reply