How to compile Wesnoth on Windows with Dev-Cpp, Code::Blocks

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderators: Forum Moderators, Developers

Locked
User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

How to compile Wesnoth on Windows with Dev-Cpp, Code::Blocks

Post by Mist » December 4th, 2007, 7:46 am

"Revenge of the devs"

Motto : You don't have to be masochistic, but it deffinitely helps :D

Once upon a time there was a simple ad quick guide to the problem, and then devs decided to use Boost...

Achieving this feat according to following guide requires about 5 hours (on dualcored 1,6GHz athlon) and over 3GB of disk space to set up dependencies. It probably can be faster and less spaceconsuming provided somebody manages selective Boost compilation for MinGW (or finds prebuilt iostreams library) :

Step 1 :

Get a clean Dev-Cpp install.

Step 2 :

Download and install latest MinGW (5.1.3). It doesn't have to be configured properly, we need the files, not a working toolchain.

Step 3 :

Copy \lib \bin \include \libexec directories from MinGW to Dev-Cpp overwriting everything as required. This results with an IDE that doesn't choke on
compiler backwards incompablity and throws allmost no warnings.

Step 4 :

Visit GnuWin32 on sourceforge. Get gettext, zlib, freetype, libpng. Unpack, move \include and \lib directories to devcpp. Rename libz.dll.a to libzdll.a. Excavate \include\freetype2\freetype directory (with contents inside) to \include.

Step 5 :

Get SDL (net, image, mixer, and overall) devel versions. Unpack, copy as above.

Step 6 :

Get python 2.4. Unpack, copy as above

Step 7 :

Get Boost and Boost-jam, unpack, move bjam.exe to boost root directory. Make about 3GB worth of free space on your HD, run cmd, set PATH to dev-cpp\bin directory. Type :

bjam -sZLIB_BINARY=zdll -sZLIB_INCLUDE=<your devcpp \include path> -sZLIB_LIBPATH=<your devcpp \lib path> --toolset=gcc

Go have a life and return after few hours. When its done find <your boost path>\bin.v2\libs\iostreams\build\gcc-mingw-3.4.5\relase and move all *.a files from that tree to dev-cpp\lib (should be six of them). Copy <your boost>path>\boost to dev-cpp\include.
You can delete boost now, only these six files are required.

Step 8 :

Get wesnoth sources. Open project file. wml_exception.cpp and wml_exception.hpp are missing, add them. Go into project options. Set compiler->linker->strip executable to yes. Go to parameters, in linker section add in new lines
-lboost_iostreams-mgw34-1_34_1
-lboost_iostreams-mgw34-mt-1_34_1
-lboost_iostreams-mgw34-mt-s-1_34_1
-lboost_iostreams-mgw34-s-1_34_1
-lzdll
First four options suffixes should correspond with file names created from building Boost

Step 9 :

Rebuild project, copy dlls from last dev relase plus libintl3.dll and libconv2.dll into main wesnoth directory.

Step 10 :

Enjoy.

If you put obtained wesnoth.exe (and those two .dll's) into a development relase directory tree translations will be working.

Disclaimer :
The process described above is neither quick nor pretty. It problably can be done quicker by building only iostreams library from boost. But because building boost for mingw is poorly documented and ridiculously unobvious pain in the ass I am not going to try streamlining above ten steps. But because I'm a good human being ;) I'm publishing a complete devcpp relase resulting from above ten step here
http://mistbinder.org/wesnoth/Dev-Cpp.zip
http://mistbinder.org/wesnoth/wesdlls.zip
http://mistbinder.org/wesnoth/wesnoth.dev
to be freely downloaded as long as the bandwidth lasts. Feel free to make this guide better, faster and more userfriendly, the community will greatly appreciate your help.
Last edited by shadowm on October 20th, 2013, 10:13 pm, edited 1 time in total.
Reason: Retiring obsolete sticky.
Somewhere, between the sacred silence and sleep.
Disorder.

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Mist » March 19th, 2008, 4:33 pm

Okay, few days late, but still there

The even more detailed guide.
featuring gcc 4.2

And thus we start. The most basic thing we need is a devcpp enviroment.
1) Get DevCpp 5.0 beta (4.9.9.2) without MinGw compiler from http://www.bloodshed.net/dev/devcpp.html
For rest of the guide I assume it's instaled directly to C: drive, and root folder for it is C:\Dev-Cpp. If you installed it somewhere else you need to use apropriate paths.

***

Now we need to get the compiler itself, after ages of trying different things it proved to be that dw2 exception handling is required.

2)Get TechnologyPreview: gcc-4.2.1-dw2-2, absolutely required are
gcc-core-4.2.1-dw2-2
gcc-g++-4.2.1-dw2-2
libgcc-dw2-1.dll
http://sourceforge.net/project/showfile ... _id=532060
If the above adress doesn't work go to MinGw project page on sourceforge and browse trough all files to download for above pack. Using sjlj pack will cause mayhem in multiplayer, make sure you got dw2. Geting stable 3.4.5 relase will work but is not covered by this guide.

After downloading these packs you need to unpack the files into dev cpp root directory (c:\dev-cpp\).
libgcc-dw2-1.dll needs to be moved to c:\dev-cpp\bin or c:\windows\system32 directory.
After this step you should have following important dirs

Code: Select all

\bin          13 files    ~3,18MB
\info         6 files      ~3,45
\lib           618 files, 41 folders ~17,5MB
\libexec    6 files, 4 folders ~12MB
***

Time to get windows API libraries

3) Get MinGw API for MS-Windows : w32api-3.11 relase
http://sourceforge.net/project/showfile ... _id=564368
Unpack contents into dev cpp root directory.
After this step following two directories should look more or less like this

Code: Select all

\include       318 files, 2 folders ~4,28MB
\lib              756 files, 41 folders ~27,1MB
***

Now windows runtime enviroment libraries

4) Get MinGW Runtime : mingw-runtime-3.14 relase
http://sourceforge.net/project/showfile ... _id=564371
Unpack into dev cpp root directory.
After this step

Code: Select all

\bin          14 files   ~3,20MB
\include    375 files, 3 folders ~4,52MB
\lib           788 files, 41 folders ~33,1MB
This concludes setting up compiler itself, everything below is required to satisfy wesnoth dependencies and compile the game itself.

****

We need SDL libraries starting with main SDL pack

5) Get SDL 1.2.13 devel : SDL-devel-1.2.13-mingw32
http://www.libsdl.org/download-1.2.php
Unpack them somewhere.
All .h files from \include\SDL\ need to go into c:\dev-cpp\include directory.
Next go into \lib directory, rename libSDL.dll.a to libSDL.a, copy contents of \lib directory to c:\dev-cpp\lib
After this step

Code: Select all

\include       407 files, 3 folders ~5MB
\lib              791 files, 41 folders ~33,4MB
***

SDL net

6) Get SDL_net devel : SDL_net-devel-1.2.7-VC8
http://www.libsdl.org/projects/SDL_net/
Unpack somewhere.
All .h files from \include need to go into c:\dev-cpp\include directory.
Go to \lib directory, rename SDL_net.lib to libSDL_net.a, copy the file to c:\dev-cpp\lib directory
After this step

Code: Select all

\include 408 files, 3 folders ~5,02MB
\lib 	 792 files, 41 folders ~33,4MB
***

SDL image

7) Get SDL_img devel : SDL_image-devel-1.2.6-VC8.zip
http://www.libsdl.org/projects/SDL_image/
Unpack somewhere.
All .h files from \include need to go into c:\dev-cpp\include directory.
Go to \lib directory, rename SDL_image.lib to libSDL_image.a, copy the file to c:\dev-cpp\lib directory
After this step

Code: Select all

\include 409 files, 3 folders ~5,03MB
\lib 	 793 files, 41 folders ~33,4MB
***

SDL mixer

8) Get SDL_mixer devel : SDL_mixer-devel-1.2.8-VC8.zip
http://www.libsdl.org/projects/SDL_mixer/
Unpack somewhere.
All .h files from \include need to go into c:\dev-cpp\include directory.
Go to \lib directory, rename SDL_mixer.lib to libSDL_mixer.a, copy the file to c:\dev-cpp\lib directory
After this step

Code: Select all

\include 410 files, 3 folders ~5,05MB
\lib 	 794 files, 41 folders ~33,4MB
***

We will also need utility aplications to supprot compiling process :

9)Get GNU binutils : binutils-2.18.50-20080109.tar.gz
http://sourceforge.net/project/showfile ... e_id=15290
Unpack somewhere.
\bin, \lib, \include, \info and \i686-pc-mingw32 folders with content need to be copied to dev-cpp root (c:\dev-cpp\)
After this step

Code: Select all

\bin	  32 files, 0 folders ~13MB
\include  415 files, 3 folders ~5,28MB
\info	  13 files, 0 folders ~5,51MB
\i686-pc-mingw32 15 files, 3 folders ~5,83MB
\lib	  797 files, 41 folders ~34,4MB
***

SDL ttf

10) Get SDL_ttf devel : SDL_ttf-devel-2.0.9-VC8.zip
http://www.libsdl.org/projects/SDL_ttf/
Unpack somewhere.
All .h files from \include need to go into c:\dev-cpp\include directory
Go to \lib directory, rename SDL_ttf.lib to libSDL_ttf.a, copy the file to c:\dev-cpp\lib directory
After this step

Code: Select all

\include  416 files, 3 folders ~5,29MB
\lib	  798 files, 41 folders ~34,4MB
***

Zlib

11) Get zlib : zlib compiled DLL, version 1.2.3, zipfile format
http://www.zlib.net/
All .h files from \include need to go into c:\dev-cpp\include directory
Open cmd shell (start->run->cmd), navigate to the place you unpacked zlib, issue following commands

Code: Select all

PATH c:\dev-cpp\bin

Code: Select all

dlltool -D zlib1.dll -d lib/zlib.def -l libz.a
Go into \lib directory and copy libz.a to c:\dev-cpp\lib
After this step

Code: Select all

\include  418 files, 3 folders ~5,36MB
\lib	  799 files, 41 folders ~34,4MB
***

We're moving to GnuWin32 project page now to get most of the remaining dependencies.
A word of warning though, GnuWin32 is a *huge* project which makes SF browsing interface *SLOW*, serious
lags and misclicks are to be expected.

libpng

12) Get libpng : libpng-1.2.24-lib.zip
http://sourceforge.net/project/showfile ... _id=565387
Unpack somewhere.
This library comes in two versions png12 and png3 we're going to use latter since it's slightly faster
Copy png.h and pngconf.h form \include (but not \include\libpng12 !) to c:\dev-cpp\include
Go to \lib directory, rename libpng.dll.a to libpng.a, copy the file to c:\dev-cpp\lib
After this step

Code: Select all

\include  420 files, 3 folders ~5,55MB
\lib	  800 files, 41 folders ~34,5MB
***

libintl

13) Get libintl : libintl-0.14.4-lib.zip
http://sourceforge.net/project/showfile ... _id=325695
Unpack somewhere.
Copy all .h files from \include to c:\dev-cpp\include
Go to \lib directory, rename libintl.dll.a to libintl.a, copy he file to c:\dev-cpp\lib
After this step

Code: Select all

\include  421 files, 3 folders ~5,56MB
\lib	  801 files, 41 folders ~34,6MB
***

libiconv

14) Get libiconv : libiconv-1.9.2-1-lib.zip
http://sourceforge.net/project/showfile ... _id=389183
Unpack somewhere.
Copy all .h files from \include to c:\dev-cpp\include
Copy libiconv.a and libcharset.a from \lib to c:\dev-cpp\lib
After this step

Code: Select all

\include  424 files, 3 folders ~5,57MB
\lib	  803 files, 41 folders ~35,5MB
***

freetype

15) Get freetype : freetype-2.3.5-1-lib.zip
http://sourceforge.net/project/showfile ... _id=584305
Unpack somewhere.
Go into \include folder, copy ft2build.h to c:\dev-cpp\include
Copy whole \freetype folder from \include\freetype2 to c:\dev-cpp\include, this should give you a
c:\dev-cpp\include\freetype folder with .h files inside, if you get this step wrong you'll face a
compilation error (path to freetype headers is hardcoded in game sources with freetype/ prefix on
includes)
Go into \lib folder, rename libfreetype.dll.a to libfreetype.a, copy the file to c:\dev-cpp\lib
After this step

Code: Select all

\include  469 files, 5 folders ~6,46MB
\lib	  804 files, 41 folders ~35,7MB


***

libjpeg

16) Get libjpeg : jpeg-6b-4-lib.zip
http://sourceforge.net/project/showfile ... _id=327497
Unpack somewhere.
Copy all .h files from \include to c:\dev-cpp\include
Go into \lib directory, rename libjpeg.dll.a to libjpeg.a, copy the file to c:\dev-cpp\lib
After this step

Code: Select all

\include  473 files, 5 folders ~6,54MB
\lib	  805 files, 41 folders ~35,7MB
***

Now we need to install python, the simplest way is to get latest relase from official page

Python

17) Get python : python-2.5.2.msi
http://www.python.org/download/releases/2.5.2/
Install, find the directory you installed to.
Copy all .h files from \include to c:\dev-cpp\include
Copy libpython25.a from \libs to c:\dev-cpp\lib
After this step

Code: Select all

\include  554 files, 5 folders ~6,91MB
\lib	  806 files, 41 folders ~36,4MB
***

Heh, forgot about GNU make, need to do that now.

18) Get GNu make : mingw32-make-3.81-2.tar.gz
http://sourceforge.net/project/showfile ... _id=531888
Unpack somewhere.
Go into \bin, rename mingw32-make.exe to make.exe, copy to c:\dev-cpp\bin
After this step

Code: Select all

\bin	33 files, 0 folders ~13,2MB
***

And now the ugly part. Boost.

19) Get boost : boost_1_34_1.zip
Get boost-jam : boost-jam-3.1.16-ntx86.zip
http://sourceforge.net/project/showfile ... up_id=7586
Unpack boost somewhere. Unpack boost-jam into the boost directory (for example if boost was in
c:\boost_temp that's where boost-jam needs to be unpacked into.)
Copy \boost directory with all headers inside to c:\dev-cpp\includes
Go into c:\dev-cpp\bin and rename :
gcc-dw2.exe to gcc.exe
g++-dw2.exe to g++.exe
c++-dw2.exe to c++.exe
cpp-dw2.exe to cpp.exe
gcov-dw2.exe to gcov.exe
Now we need to set enviroment PATH variable to c:\dev-cpp\bin. There are two ways to do this :
a) open cmd shell (start->run->cmd), enter

Code: Select all

PATH c:\Dev-Cpp\bin
test wether it worked by issuing

Code: Select all

gcc
command which should complain about no input files
b) This involves editing windows enviroment variable, I'll not describe this since exact procedure varies in each
OS version
In the same shell you issued PATH command navigate to boost directory (the same place you unpacked boost-jam into)
Issue the following commands :

Code: Select all

bjam -sZLIB_BINARY=z -sZLIB_INCLUDE=c:\dev-cpp\include -sZLIB_LIBPATH=c:\dev-cpp\lib --toolset=gcc --with-iostreams
should update 77 targets

Code: Select all

bjam --toolset=gcc --with-regex
should update 165 targets
Runing these created bin.v2 directory in main boost one. go intto:
\bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\link-static\threading-multi
rename libboost_iostreams-mgw42-mt-1_34_1.a to libbost_iostreams_dw2.a and copy to c:\dev-cpp\lib
go into
\bin.v2\libs\regex\build\gcc-mingw-4.2.1\release\link-static\threading-multi
rename libboost_regex-mgw42-mt-1_34_1.a to libbost_regex_dw2.a and copy to c:\dev-cpp\lib
After this step you should have

Code: Select all

\include 	4328 files, 283 folders ~32,7MB
\lib		809 files, 41 folders ~38MB
That's it, this is the compiling enviroment that should allow you to build wesnoth. Get a checkout of the sources
(or a tarball from SF) open the project file (double-click on wesnoth.dev) go into project options->parameters, there
should be following c++ flags :
-DHAVE_PYTHON
-DUSE_GZIP
-fexceptions
-mthreads
and following linker flags :
-lmingw32
-mthreads
-lSDLmain
-lSDL
-lSDL_image
-lSDL_net
-lSDL_mixer
-lSDL_ttf
-lmingwthrd
-lfreetype
-lintl
-lpython25
-lpng
-lboost_iostreams_dw2
-lboost_regex_dw2
-lz
-lwsock32
-ljpeg
If everything looks ok just hit execute->rebuild.

To run the exe you'll need to place it in wesnoth tree along with .dll files. Most of these dlls can be found in
\bin directories of packages listed above or -bin packages in case of GnuWin32 downloads.

The End

PS. This recipee is for trunk as of 19.03.2008, things might change in the future, in general it's advisable to
replace any of above packages with never version if such version get's relased. I'll also try to keep the project
file up to date, but I'm just human and might fail at this every now and then.

Known issues :
*newer intel cpus (P4 and upwards) seem to have problems with handling boost compiled by MinGW gcc
*some K6-3 cpus need to be build with additional -march=k6-3 c++ and linker flag
Somewhere, between the sacred silence and sleep.
Disorder.

cjhopman
Inactive Developer
Posts: 30
Joined: March 18th, 2008, 3:29 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by cjhopman » March 19th, 2008, 7:10 pm

Thanks very much for that, quite helpful.

I hope you don't mind if I add a bit here to make it a bit easier/quicker for people...

So, I've did most of the work so that you guys don't have to. So, here is a modified process.

As you go through the process the include directory I believe stays the size as Mist has it above, but the others get a couple extra files... shouldn't matter.

I'm just hosting these files on my site from my cs dept. Don't know if they will cut me off if I get too much traffic... we'll see.

NOTE: I give no guarantees that this will work for you. Try at your own risk.

1. As above, download and install Dev-Cpp w/o mingw.


From now on, make extensive use of Dev-Cpp's package manager.
You can load it up with PackMan.exe in the Dev-Cpp dir.

2. Download:

http://pages.cs.wisc.edu/~hopman/wesnot ... -dw2-2.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -dw2-2.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... _1.dll.zip

And install them with Package Manager. Just go to install and select "generic packages" for file type.

Files are already be renamed as in above instructions. All packages you install should already have files renamed.

3 - 10. Download and install as packages:

http://pages.cs.wisc.edu/~hopman/wesnot ... i-3.11.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... e-3.14.zip
http://pages.cs.wisc.edu/~hopman/wesnoth/SDL-1.2.13.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -1.2.7.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -1.2.6.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -1.2.8.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... 080109.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -2.0.9.zip

11. Follow original instructions.

12-16. Download and install as packages:

http://pages.cs.wisc.edu/~hopman/wesnot ... 24-lib.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... .4-lib.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -1-lib.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -1-lib.zip
http://pages.cs.wisc.edu/~hopman/wesnot ... -4-lib.zip

17. Follow original instructions.

/*
Might be able to get by with installing Python and the downloading and installing as a package the following:
http://pages.cs.wisc.edu/~hopman/wesnoth/python25.zip
*/

18. Download and install as a package:

http://pages.cs.wisc.edu/~hopman/wesnot ... 3.81-2.zip

19. Do as in original.


For compiling, I think you want wesnoth_gcc4.dev (at least, that's what I used).

dlls for running .exe are at

http://pages.cs.wisc.edu/~hopman/wesnot ... h-dlls.zip

Again, many thanks to Mist, as without him I'd have never figured all this out.

User avatar
McShark
Posts: 76
Joined: March 19th, 2008, 10:41 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by McShark » March 19th, 2008, 10:52 pm

Good work! My hint and question to these posts:
1. For setting the environment the following should work with all MS OS

Code: Select all

set PATH=%PATH%;C:\Dev-Cpp\bin
2. I used Mist's list for dev c++ and the wesnoth_gcc4.dev. On compiling I get this
47 \src\server\server.cpp sys/times.h: No such file or directory.
The problem is: there is no times.h in all mentioned packages. Any ideas?

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Mist » March 19th, 2008, 11:38 pm

Server and editor project files need looking at, which will happen tommorow when I'm back from work. Server might also not compile due to the fact that Sirp is fiddling with it and breaking things at extraordinary speed ;)
Somewhere, between the sacred silence and sleep.
Disorder.

Derekkk
Posts: 64
Joined: April 25th, 2007, 5:43 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Derekkk » March 20th, 2008, 10:09 pm

Mist, would you mind clarifying which wesnoth version is the first compiling procedure for, and if the second one works for wesnoth 1.4? I tried to compile 1.4 with the second procedure but it didn't work. Right before the rebuilding step, I checked the packaging manager of dev-cpp and the lboost for regex was missing. Naturally, the rebuilding process failed. It might be that I made a mistake along the way but I also tried cjhopman's method and that failed as well.

Derekkk

User avatar
McShark
Posts: 76
Joined: March 19th, 2008, 10:41 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by McShark » March 20th, 2008, 11:03 pm

It is for Wesnoth 1.4 SVN. The first one seems to work.
There is no problem with times.h at the moment, but another one during bjam-call:
6 times crash of dec-cpp\bin\ld.exe

Do I have to do ALL of the procedure again or do you have some guesses what I can do else than that?

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Mist » March 20th, 2008, 11:36 pm

@Derekkk

It is for current trunk (I wrote that at the bottom if you look carefuly) but it should still work for 1.4 tarball/checkout, the only difference is lack of formual AI files and lack of boost regex-dependency. My guess is that you made a mistake somewhere, post your compiler errors I'll tell you what's wrong.

@McShark
sys/times.h issue was solved this morning, Sirp introduced a times() function from POSIX standart that required the header but he forgot that win32 is only vaguely conformant to the standart and has neither of the two. That has been worked around now and won't pop up again.
About these ld errors. It's a shame you didn't paste one as an example, but I strongly suspect they are connected to zlib building step.
Did you run the dlltool command? Did it produce a libz.a? If yes what size is the file? In short check/redo step 11) and then try building boost once more.
Somewhere, between the sacred silence and sleep.
Disorder.

User avatar
McShark
Posts: 76
Joined: March 19th, 2008, 10:41 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by McShark » March 21st, 2008, 12:37 pm

Tank you for your help. Maybe you want to edit your instructions about setting PATH as mentioned before to

Code: Select all

set PATH=%PATH%;C:\Dev-Cpp\bin
Mist wrote:Did you run the dlltool command? Did it produce a libz.a? If yes what size is the file? In short check/redo step 11) and then try building boost once more.
Yes, yes, size: 37.042 Bytes. Tried step 11 again, same libz.a size.
Step 19 with

Code: Select all

bjam -sZLIB_BINARY=z -sZLIB_INCLUDE=c:\dev-cpp\include -sZLIB_LIBPATH=c:\dev-cpp\lib --toolset=gcc --with-iostreams > build.log
results in
...patience...
...found 615 targets...
...updating 5 targets...
gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.a
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.a
collect2: ld returned 5 exit status
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.a

"g++" -L"C:\Dev-Cpp\lib" "-Wl,--out-implib,bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.a" -o "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.dll" -shared -Wl,--start-group "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\file_descriptor.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\mapped_file.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\zlib.o" -lz -Wl,--end-group -g -mthreads

...failed gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.a bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.dll...
...removing bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\threading-multi\boost_iostreams-mgw42-mt-d-1_34_1.a
gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.a
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.a
collect2: ld returned 5 exit status
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.a

"g++" -L"C:\Dev-Cpp\lib" "-Wl,--out-implib,bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.a" -o "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.dll" -shared -Wl,--start-group "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\file_descriptor.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\mapped_file.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\zlib.o" -lz -Wl,--end-group -Wl,--strip-all -mthreads

...failed gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.a bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.dll...
...removing bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\threading-multi\boost_iostreams-mgw42-mt-1_34_1.a
gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.a
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.a
collect2: ld returned 5 exit status
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.a

"g++" -L"C:\Dev-Cpp\lib" "-Wl,--out-implib,bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.a" -o "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.dll" -shared -Wl,--start-group "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\file_descriptor.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\mapped_file.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\zlib.o" -lz -Wl,--end-group -g

...failed gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.a bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.dll...
...removing bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\debug\boost_iostreams-mgw42-d-1_34_1.a
gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.a
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.a
collect2: ld returned 5 exit status
Creating library file: bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.a

"g++" -L"C:\Dev-Cpp\lib" "-Wl,--out-implib,bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.a" -o "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.dll" -shared -Wl,--start-group "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\file_descriptor.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\mapped_file.o" "bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\zlib.o" -lz -Wl,--end-group -Wl,--strip-all

...failed gcc.link.dll bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.a bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.dll...
...removing bin.v2\libs\iostreams\build\gcc-mingw-4.2.1\release\boost_iostreams-mgw42-1_34_1.a
...failed updating 5 targets...
Seems to be a problem with gcc???

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Mist » March 22nd, 2008, 3:08 am

exit status 5 means attempting to link with more than one deffinition of a symbol. Now that still looks like an issue with building zlib, but somewhat different to what I tought.

First, try to build iostreams without zlib support (that's remove all three -sZLIB_* entries from the querry), result should build without failed targets, if that happens it'll confirm the theory. Don't use the resulting lib to build wesnoth because zlib support is absolutely neccesarry.
If above builds properly go to zlib project page and get sources packed as .zip. Unpack them somewhere, run shell, set the PATH to devcpp bin directory, navigate to unpacked sources and exectute

Code: Select all

make.exe
This should build zlib from sources for usage with MinGW in two versions : libz.a and libzdll.a take the first one (it's a static lib so it's larger and doesn't need dll in future) and try to build boost again with it (remove the v2.bin directory before you start to make sure old objects arent used)
Somewhere, between the sacred silence and sleep.
Disorder.

User avatar
McShark
Posts: 76
Joined: March 19th, 2008, 10:41 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by McShark » March 22nd, 2008, 11:27 pm

The result of

Code: Select all

bjam --toolset=gcc --with-iostreams > build.log
is quite the same as before
...failed updating 8 targets...
and chrash of ld.exe 4 times.
Seems to be no problem with zlib for me. Any other ideas?

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Mist » March 23rd, 2008, 4:09 am

To be honest, no. Does the regex build without problems?

Anyway, attaching compiled boost::iostreams and boost::regex libs so you can ignore the step.
Attachments
libboost_regex_dw2.zip
(378.44 KiB) Downloaded 1165 times
libboost_iostreams_dw2.zip
(11.61 KiB) Downloaded 1281 times
Somewhere, between the sacred silence and sleep.
Disorder.

User avatar
McShark
Posts: 76
Joined: March 19th, 2008, 10:41 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by McShark » March 23rd, 2008, 1:24 pm

Regex had no problems. Thank you for your downloads. In your first instructions is a misspelling, I think. You've wrote
rename libboost... to libbost...
I've tried all *.dev. they result in (have a guess...)
ld returned 5 exit status
And a crash of ld.exe. I'll delete my dev-c++ installation and start from scratch.

wesnoth_gcc4.dev, wesnothd_gcc4.dev and wesnothd.dev are very faster during compile than wesnoth.dev and unit_test.dev. Can you explain why?

By the way, when using wesnoth.dev or unit_test.dev or editor.dev:
File \src\sdl_ttf\SDL_ttf.h not found
File \src\sdl_ttf\SDL_ttf.c not found
when using server.dev.
File \src\server\variable.cpp not found
File \src\zipios++\xcoll.hpp not found
File \src\zipios++\xcoll.cpp not found
When using unit_test.dev
105 multiple definition of `double lexical_cast_default<double, std::string const&>(std::string const&, double)'
82 \src\util.o(.text+0x10c):src\util.cpp first defined here
82 \src\util.o(.text+0x10c):src\util.cpp cannot find -lboost_unit_test_framework-mgw-mt-s-1_34_1
Are still four wesnoth*.dev's necessary or should some be removed from svn?
Thank you for your help!

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by Mist » March 23rd, 2008, 1:38 pm

_gcc4 dev files are faster because they have been prepared with compilation as a sole purpose. The files compile in oreder they are requested by the compiler, ther is no overhead of sources that are actualy not required and there are no headers in the project that need to be skipped over when compiling. Additionaly there is no -OX flag (optimisations) and I think there is -O2 in older projects.

wesnoth, wesnothd and editor.dev are still needed for people that use installations based on gcc 3.4.5

unit_test.dev is not my creation and as such I can't tell why it's not working (but I'll still have a look at it)

server.dev is obsoleted by wesnothd.dev

Retrying the installation of devcpp might be a good idea, tell me how it works out.
Somewhere, between the sacred silence and sleep.
Disorder.

User avatar
McShark
Posts: 76
Joined: March 19th, 2008, 10:41 pm

Re: How to compile Wesnoth on Windows with Dev-Cpp

Post by McShark » March 23rd, 2008, 9:16 pm

The even more and easier detailed guide.

This guide, featuring gcc 4.2, is kind a copy of Mist's one, but contains deeplinks, so that there is no need to look for the right link any more. There are also some hints and knowledge left out, so if you have problems: take Mist's guide.

And thus we start. The most basic thing we need is a devcpp environment.
  1. Get DevCpp 5.0 beta (4.9.9.2) without MinGw compiler from Sourceforge and install it somewhere. For rest of the guide I assume it's installed directly to C: drive, and root folder for it is C:\Dev-Cpp. If you installed it somewhere else you need to use apropriate paths.
  2. Get TechnologyPreview: gcc-4.2.1-dw2-2, absolutely required are
    gcc-core-4.2.1-dw2-2
    gcc-g++-4.2.1-dw2-2
    libgcc-dw2-1.dll
    After downloading these packs you need to unpack the files into dev cpp root directory (c:\dev-cpp\).
    libgcc-dw2-1.dll needs to be moved to c:\dev-cpp\bin or c:\windows\system32 directory.
  3. Get MinGw API for MS-Windows : w32api-3.11 relase
    Unpack contents into dev cpp root directory.
  4. Get MinGW Runtime : mingw-runtime-3.14 relase
    Unpack into dev cpp root directory.
  5. Get SDL 1.2.13 devel : SDL-devel-1.2.13-mingw32
    Unpack them somewhere.
    All .h files from \include\SDL\ need to go into c:\dev-cpp\include directory.
    Next go into \lib directory, rename libSDL.dll.a to libSDL.a, copy contents of \lib directory to c:\dev-cpp\lib
  6. Get SDL_net devel : SDL_net-devel-1.2.7-VC8
    Unpack somewhere.
    All .h files from \include need to go into c:\dev-cpp\include directory.
    Go to \lib directory, rename SDL_net.lib to libSDL_net.a, copy the file to c:\dev-cpp\lib directory
  7. Get SDL_img devel : SDL_image-devel-1.2.6-VC8.zip
    Unpack somewhere.
    All .h files from \include need to go into c:\dev-cpp\include directory.
    Go to \lib directory, rename SDL_image.lib to libSDL_image.a, copy the file to c:\dev-cpp\lib directory
  8. Get SDL_mixer devel :SDL_mixer-devel-1.2.8-VC8.zip
    Unpack somewhere.
    All .h files from \include need to go into c:\dev-cpp\include directory.
    Go to \lib directory, rename SDL_mixer.lib to libSDL_mixer.a, copy the file to c:\dev-cpp\lib directory
  9. Get GNU binutils : binutils-2.18.50-20080109.tar.gz
    Unpack somewhere.
    \bin, \lib, \include, \info and \i686-pc-mingw32 folders with content need to be copied to dev-cpp root (c:\dev-cpp\)
  10. Get SDL_ttf devel : SDL_ttf-devel-2.0.9-VC8.zip
    Unpack somewhere.
    All .h files from \include need to go into c:\dev-cpp\include directory
    Go to \lib directory, rename SDL_ttf.lib to libSDL_ttf.a, copy the file to c:\dev-cpp\lib directory
  11. Get zlib : zlib compiled DLL, version 1.2.3, zipfile format
    All .h files from \include need to go into c:\dev-cpp\include directory
    Open cmd shell (start->run->cmd), navigate to the place you unpacked zlib, issue following commands

    Code: Select all

    set PATH=%PATH%;c:\dev-cpp\bin
    

    Code: Select all

    dlltool -D zlib1.dll -d lib/zlib.def -l libz.a
    
    Go into \lib directory and copy libz.a to c:\dev-cpp\lib [For me, it was in my unpacked folder, not unpacked\lib]
  12. Get libpng : libpng-1.2.24-lib.zip
    Unpack somewhere.
    Copy png.h and pngconf.h form \include (but not \include\libpng12 !) to c:\dev-cpp\include
    Go to \lib directory, rename libpng.dll.a to libpng.a, copy the file to c:\dev-cpp\lib
  13. Get libintl : libintl-0.14.4-lib.zip
    Unpack somewhere.
    Copy all .h files from \include to c:\dev-cpp\include
    Go to \lib directory, rename libintl.dll.a to libintl.a, copy the file to c:\dev-cpp\lib
  14. Get libiconv : libiconv-1.9.2-1-lib.zip
    Unpack somewhere.
    Copy all .h files from \include to c:\dev-cpp\include
    Copy libiconv.a and libcharset.a from \lib to c:\dev-cpp\lib
  15. Get freetype : freetype-2.3.5-1-lib.zip
    Unpack somewhere.
    Go into \include folder, copy ft2build.h to c:\dev-cpp\include
    Copy whole \freetype folder from \include\freetype2 to c:\dev-cpp\include, this should give you a
    c:\dev-cpp\include\freetype folder with .h files inside, if you get this step wrong you'll face a
    compilation error (path to freetype headers is hardcoded in game sources with freetype/ prefix on
    includes)
    Go into \lib folder, rename libfreetype.dll.a to libfreetype.a, copy the file to c:\dev-cpp\lib
  16. Get libjpeg : jpeg-6b-4-lib.zip
    Unpack somewhere.
    Copy all .h files from \include to c:\dev-cpp\include
    Go into \lib directory, rename libjpeg.dll.a to libjpeg.a, copy the file to c:\dev-cpp\lib
  17. Get Lua : lua5_1_4_Win32_dll8_lib.zip and unpack content of includes to your includes-folder, the two dlls into wesnoth folder and the two lib-files to your lib-folder.
  18. Get python : python-2.5.4.msi
    Install, find the directory you installed to.
    Copy all .h files from \include to c:\dev-cpp\include
    Copy libpython25.a from \libs to c:\dev-cpp\lib
  19. Get GNu make : mingw32-make-3.81-2.tar.gz
    Unpack somewhere.
    Go into \bin, copy mingw32-make.exe and rename the duplicate to make.exe, copy both to c:\dev-cpp\bin
  20. Get boost : boost_1_37_0.zip
    Unpack boost somewhere.
    Copy \boost directory with all headers inside to c:\dev-cpp\includes
  21. Boost-libs: Download and copy the two files libboost_regex_dw2.zip and libboost_iostreams_dw2.zip to c:\dev-cpp\lib
  22. renaming:
    Go into c:\dev-cpp\bin and rename :
    gcc-dw2.exe to gcc.exe
    g++-dw2.exe to g++.exe
    c++-dw2.exe to c++.exe
    cpp-dw2.exe to cpp.exe
    gcov-dw2.exe to gcov.exe
That's it, this is the compiling environment that should allow you to build wesnoth. Get a checkout of the sources
(or a tarball from SF), open the project file (double-click on wesnoth_gcc4.dev).

If everything looks ok just hit execute->rebuild.

To run the exe you'll need to place it in wesnoth tree along with .dll files. These can be dowloaded here. Unpack them into the wesnoth tree. For my installation, it was also necessary to copy phyton25.dll from phyton installation to wesnoth folder.

The End

PS. This recipe is for trunk as of 13.03.2008, things might change in the future. It is recommend to use newer versions of these packs if available
Last edited by McShark on March 23rd, 2009, 8:40 pm, edited 4 times in total.

Locked