How to compile with scons on Windows V1.5.1/Linux Mint
Moderator: Forum Moderators
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
How to compile with scons on Windows V1.5.1/Linux Mint
1) Download the installers for pre-requisite software.
2) Install Git.
3) Install Python.
4) Install scons.
5) Install pywin32.
6) Install tdm-gcc-5.1.0-2.
6a) When installing, you need to uncheck the "Check for updated files" box and make sure that OpenMP is enabled.
7) Add Git, scons, and tdm-gcc-5.1.0-2 to your PATH environment variable.
7a) To do this: Start Menu > right click on "Computer" > click "Properties" > click "Advanced System Settings" on the left (requires administrator rights) > this will pop up a "System Properties" windows, click "Environment Variables..." towards the bottom right > Another window will pop up, go to the "System Variables" part and scroll down until you see "Path" > click it and then click "Edit..." > put all the locations of the .exe/.bat files for the above programs, separated by semi-colons.
Example of mine:
PATH Variable Hint
Easy way to avoid typing the entire path to somewhere
7b) You may need to restart your computer for it to use the updated PATH variable.
8 ) Open a command prompt and download the wesnoth repository by typing:
This will take some time, as the full repository is ~3 GBs.
This will also get the latest development version, to get the 1.12 version instead do:
9) Download this, which contains all the requirements to actually compile the source code that you just downloaded.
9a) Extract it to wherever you told git to put wesnoth.
9b) Add <wesnoth directory>/scons_dependencies/bin to your PATH variable.
10) Go to <wesnoth directory>/scons_dependencies/boost_1_59_0
10a) Run make.bat.
10b) Wait for Boost to compile. This may take some time depending on your computer, but you'll never have to do it again.
11) Go to <wesnoth directory> and run make_scons.bat. This will build wesnoth.
11a) This may take some time, especially for the first build.
12) To update your files, just use:
from <wesnoth directory>
------Known Issues/FAQ------
1) Scons may complain about a few things:
These warnings can also be ignored.
------Sources for dependencies------
------Changelog------
~~~~~~Linux Mint~~~~~~
0. Tested on Mint 17.2.
1) Install git from the Software Manager if you don't have it already.
2) Download the wesnoth repository with the command:
This will also get the latest development version, to get the 1.12 version instead do:
3) While git is downloading the repository, go back to the Software Manager and install the prerequisites.
You can check what you already have installed via the Software Manager or with the dpkg command, for example to check for SDL libraries:
which for me returns this.
NOTE: If you install the full boost package rather than the individual libraries, dpkg will for whatever reason not being able to find the asio library but it is there.
4) Download the attached scripts.7z archive and extract it to your wesnoth directory. It will contain two bash scripts.
4a) start.sh will start wesnoth without a terminal open and log all output to wesnoth.log
4b) update.sh will run the command
and offer to recompile/restart/do nothing based the output which is saved to git.log. It will use scons to compile wesnoth and save the output to scons.log.
NOTE: By default I've set scons to use the --config=force option which forces scons to recompile everything each time. To only recompile files that have changed just remove that option from the scons command.
NOTE: By default I've set scons to use clang, to use a different compiler set the value of the cxxtool option.
NOTE: This will kill wesnoth, so it WILL NOT save before closing.
2) Install Git.
3) Install Python.
4) Install scons.
5) Install pywin32.
6) Install tdm-gcc-5.1.0-2.
6a) When installing, you need to uncheck the "Check for updated files" box and make sure that OpenMP is enabled.
7) Add Git, scons, and tdm-gcc-5.1.0-2 to your PATH environment variable.
7a) To do this: Start Menu > right click on "Computer" > click "Properties" > click "Advanced System Settings" on the left (requires administrator rights) > this will pop up a "System Properties" windows, click "Environment Variables..." towards the bottom right > Another window will pop up, go to the "System Variables" part and scroll down until you see "Path" > click it and then click "Edit..." > put all the locations of the .exe/.bat files for the above programs, separated by semi-colons.
Example of mine:
Code: Select all
;C:\Program Files (x86)\Git\bin;C:\TDM-GCC-64\bin;C:\Python27\Scripts
Easy way to avoid typing the entire path to somewhere
7b) You may need to restart your computer for it to use the updated PATH variable.
8 ) Open a command prompt and download the wesnoth repository by typing:
Code: Select all
git clone git://github.com/wesnoth/wesnoth.git Drive:/Path/To/Where/You/Want/Wesnoth
This will also get the latest development version, to get the 1.12 version instead do:
Code: Select all
git clone git://github.com/wesnoth/wesnoth.git Drive:/Path/To/Where/You/Want/Wesnoth --branch 1.12
9a) Extract it to wherever you told git to put wesnoth.
9b) Add <wesnoth directory>/scons_dependencies/bin to your PATH variable.
10) Go to <wesnoth directory>/scons_dependencies/boost_1_59_0
10a) Run make.bat.
10b) Wait for Boost to compile. This may take some time depending on your computer, but you'll never have to do it again.
11) Go to <wesnoth directory> and run make_scons.bat. This will build wesnoth.
11a) This may take some time, especially for the first build.
12) To update your files, just use:
Code: Select all
git pull
Optional:
1) Scons may complain about a few things:
Code: Select all
Checking for dbus-1... (cached) no
Checking for fribidi >= 0.10.9... (cached) no
Can't find libfribidi, disabling freebidi support.
Checking for Boost unit_test_framework library... yes
WARN: Unit tests are disabled because their prerequisites are not met
If any config checks fail, look in build/config.log for details
If a check fails spuriously due to caching, use --config=force to force its rerun
NLS tools are not present...
NLS catalogue installation is disabled.
utils is not recognized as an internal or external command.
------Sources for dependencies------
Spoiler:
Spoiler:
0. Tested on Mint 17.2.
1) Install git from the Software Manager if you don't have it already.
2) Download the wesnoth repository with the command:
Code: Select all
git clone git://github.com/wesnoth/wesnoth.git /path/to/wesnoth
Code: Select all
git clone git://github.com/wesnoth/wesnoth.git /path/to/wesnoth --branch 1.12
You can check what you already have installed via the Software Manager or with the dpkg command, for example to check for SDL libraries:
Code: Select all
dpkg -l | grep '||/\|libsdl'
NOTE: If you install the full boost package rather than the individual libraries, dpkg will for whatever reason not being able to find the asio library but it is there.
4) Download the attached scripts.7z archive and extract it to your wesnoth directory. It will contain two bash scripts.
4a) start.sh will start wesnoth without a terminal open and log all output to wesnoth.log
4b) update.sh will run the command
Code: Select all
git pull
NOTE: By default I've set scons to use the --config=force option which forces scons to recompile everything each time. To only recompile files that have changed just remove that option from the scons command.
NOTE: By default I've set scons to use clang, to use a different compiler set the value of the cxxtool option.
NOTE: This will kill wesnoth, so it WILL NOT save before closing.
- Attachments
-
- scripts.7z
- (1.16 KiB) Downloaded 966 times
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: How to compile with scons on Windows
Note: I put a link to this on the wiki: http://wiki.wesnoth.org/CompilingWesnothOnWindows
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: How to compile with scons on Windows
Thanks
Also, I've made a post on stackoverflow about the bzip2 issue, so hopefully there'll be an answer.
Also, I've made a post on stackoverflow about the bzip2 issue, so hopefully there'll be an answer.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
-
- Developer
- Posts: 546
- Joined: January 12th, 2011, 2:18 am
- Location: Pennsylvania, USA
Re: How to compile with scons on Windows V1.2
Thanks for this
Something to note, a reboot may be required for Path variable changes to be recognized, it needed it on my system (Win 7 x64).
Also, when I run make_scons.bat, it seems to do a full rebuild every time, even if nothing's changed. Is there a setting I'm missing?
Something to note, a reboot may be required for Path variable changes to be recognized, it needed it on my system (Win 7 x64).
Also, when I run make_scons.bat, it seems to do a full rebuild every time, even if nothing's changed. Is there a setting I'm missing?
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: How to compile with scons on Windows V1.2
In the make_scons.bat file on line 37, change
to
Code: Select all
call scons -j %coreCount% --config=force 2> scons_log.txt
Code: Select all
call scons -j %coreCount% 2> scons_log.txt
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: How to compile with scons on Windows V1.2
Well... I don't know it helps, but I try to share my experience when I compiled wesnoth 1.8.0 on Windows (now I don't have Windows anymore, and a lot of time passed from 1.8.0).
---------------------------------
Compiling Wesnoth on Windows, with Mingw gcc / g++ and scons:
----------------------------------
1) First of all you require to download a window version of PkgConfig, that allows you to find libraries, and eventually modify .pc files you need
2) sdl-config replacement -> if you, like me, don't use cygwin you need to replace somehow the output of sdl-config. I resolved creating a sdl-config.exe file, but you can simply create a sdl-config.bat file... I don't know how exactly a bat can parse command line, however you can echo all the flags together (linking and compiling ones)... scons will use the cflags when compiling and lflags when linking. I don't remember the CFLAGS, but the most important linking flags are
-L"path\of\SDL.dll" -lSDL_main -lSDL
for compiling flags you will need surely -I"include\path\of\SDL", but I miss if some defines are required
3) Make sure that gcc, g++, make, PkgConfig and sdl-config (.bat or .exe created by you) are in path
4) Development libraries - dependencies of Wesnoth. Make sure you have all .dll and .h you need. In some cases you can use precompiled development libraries (if they cames from c, like SDL, you can use also .DLL builded with Visual Studio) but in some cases you need to compile libraries by yourself... for example you need to compile yourself boot libraries. Check the corresponding .pc file used on PkgConfig and change it if you placed somewhere else .h and .DLL files
5) download and install python... this can be obvious, since we are using scons, but we must don't forget it
6) download and install scons
7) run scons (I simply runned "scons", when I compiled 1.8.0, if I remember well) from the main directory of the wesnoth sources
8_) finally wesnoth.exe produced somewhere. You could need to move some .dll (s) to the directory where you will move the newly produced wesnoth.exe
HOPE this helps, and hope I didn't forget anything (a lot of times passed)
---------------------------------
Compiling Wesnoth on Windows, with Mingw gcc / g++ and scons:
----------------------------------
1) First of all you require to download a window version of PkgConfig, that allows you to find libraries, and eventually modify .pc files you need
2) sdl-config replacement -> if you, like me, don't use cygwin you need to replace somehow the output of sdl-config. I resolved creating a sdl-config.exe file, but you can simply create a sdl-config.bat file... I don't know how exactly a bat can parse command line, however you can echo all the flags together (linking and compiling ones)... scons will use the cflags when compiling and lflags when linking. I don't remember the CFLAGS, but the most important linking flags are
-L"path\of\SDL.dll" -lSDL_main -lSDL
for compiling flags you will need surely -I"include\path\of\SDL", but I miss if some defines are required
3) Make sure that gcc, g++, make, PkgConfig and sdl-config (.bat or .exe created by you) are in path
4) Development libraries - dependencies of Wesnoth. Make sure you have all .dll and .h you need. In some cases you can use precompiled development libraries (if they cames from c, like SDL, you can use also .DLL builded with Visual Studio) but in some cases you need to compile libraries by yourself... for example you need to compile yourself boot libraries. Check the corresponding .pc file used on PkgConfig and change it if you placed somewhere else .h and .DLL files
5) download and install python... this can be obvious, since we are using scons, but we must don't forget it
6) download and install scons
7) run scons (I simply runned "scons", when I compiled 1.8.0, if I remember well) from the main directory of the wesnoth sources
8_) finally wesnoth.exe produced somewhere. You could need to move some .dll (s) to the directory where you will move the newly produced wesnoth.exe
HOPE this helps, and hope I didn't forget anything (a lot of times passed)
-
- Developer
- Posts: 546
- Joined: January 12th, 2011, 2:18 am
- Location: Pennsylvania, USA
Re: How to compile with scons on Windows V1.3.1
For anyone who was wondering, the 1.3.1 version of scons compile works on the 1.12 branch as well, from about 1.11.17 on.
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
Re: How to compile with scons on Windows V1.3.3
Just a comment to possibly improve the script:
Since you said "it takes a really long time but fortunately you never have to do it again", I took a look at your boost configuration line in make.bat:
This line will compile every single library in boost. There's like 60+ of them, and some of them are huge. We only use 6 of them. If you add these options to the bjam line, you will only compile the ones we actually use, and it should go much faster.
The downside is that if we add more of them you have to remember to add them to the list here, but that doesn't seem like such a big deal.
Since you said "it takes a really long time but fortunately you never have to do it again", I took a look at your boost configuration line in make.bat:
Code: Select all
call bjam -j %coreCount% -s ZLIB_SOURCE=%dependencyDir%\zlib -s BZIP2_SOURCE=%dependencyDir%\bzip2 --toolset=gcc 2> make_log.txt
Code: Select all
--with-iostreams --with-locale --with-regex --with-filesystem --with-system --with-program_options
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: How to compile with scons on Windows V1.3.3
Wow, that is a lot faster. It does also need
as well though.
Code: Select all
--with-random
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: How to compile with scons on Windows V1.3.8
Confirmed it to be working with Windows 10 64-bit.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: How to compile with scons on Windows V1.3.8/Linux Mint
Added some basic instructions for Linux Mint.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
-
- Developer
- Posts: 546
- Joined: January 12th, 2011, 2:18 am
- Location: Pennsylvania, USA
Re: How to compile with scons on Windows V1.3.8/Linux Mint
Has anyone had this working for master since commit:
8f8fde43bad8089c1735a37001e4a44e91f212b5
* fs: Use SHGetFolderPath() instead of SHGetSpecialFolderPath()
on 2015/10/20 ?
The Windows Scons compile doesn't work for me after that, and I did a clean install of master and Windows Scons 1.3.8 version.
Here's my log.
Would fixing the "src\filesystem_boost.cpp:517:13: error: 'SHGFP_TYPE_CURRENT' was not declared in this scope" error at the bottom work, or would this be an adjustment to the Windows Scons method, or something else?
8f8fde43bad8089c1735a37001e4a44e91f212b5
* fs: Use SHGetFolderPath() instead of SHGetSpecialFolderPath()
on 2015/10/20 ?
The Windows Scons compile doesn't work for me after that, and I did a clean install of master and Windows Scons 1.3.8 version.
Here's my log.
Spoiler:
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
Re: How to compile with scons on Windows V1.3.8/Linux Mint
Are you using MinGW? You might want to try a newer version or MinGW-w64 (greatly recommended as vanilla MinGW can’t build SDL 2.0’s headers, which will become a hard requirement in 1.13.3). In general, MinGW appears to be lagging years behind MinGW-w64 in terms of support for APIs introduced after the original Windows XP RTM build.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: How to compile with scons on Windows V1.3.8/Linux Mint
I haven't built wesnoth on windows for a while now, having moved to Mint, but I am getting the same error as you now that I try it.SigurdFireDragon wrote:Has anyone had this working for master since commit:
8f8fde43bad8089c1735a37001e4a44e91f212b5
* fs: Use SHGetFolderPath() instead of SHGetSpecialFolderPath()
on 2015/10/20 ?
The Windows Scons compile doesn't work for me after that, and I did a clean install of master and Windows Scons 1.3.8 version.
Here's my log.Would fixing the "src\filesystem_boost.cpp:517:13: error: 'SHGFP_TYPE_CURRENT' was not declared in this scope" error at the bottom work, or would this be an adjustment to the Windows Scons method, or something else?Spoiler:
It uses MinGW since that's what comes bundled with the tdm-gcc installer. tdm-gcc has stayed at 4.5.2 32-bit since I was never able to get wesnoth to compile with any higher version, nor with the 64-bit version of tdm-gcc that comes with MinGW-w64. Apparently that has changed somewhat recently, though 64-bit is apparently still not supported.shadowm wrote:Are you using MinGW? You might want to try a newer version or MinGW-w64 (greatly recommended as vanilla MinGW can’t build SDL 2.0’s headers, which will become a hard requirement in 1.13.3). In general, MinGW appears to be lagging years behind MinGW-w64 in terms of support for APIs introduced after the original Windows XP RTM build.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: How to compile with scons on Windows V1.3.8/Linux Mint
You can use the 64-bit version of TDM-GCC and it may in fact yield better results with some large files in -O0 mode (as opposed to crashing due to hitting object size limits); you just need to addPentarctagon wrote:It uses MinGW since that's what comes bundled with the tdm-gcc installer. tdm-gcc has stayed at 4.5.2 32-bit since I was never able to get wesnoth to compile with any higher version, nor with the 64-bit version of tdm-gcc that comes with MinGW-w64. Apparently that has changed somewhat recently, though 64-bit is apparently still not supported.
-m32
to the compiler and linker command lines, and -F pe-i386
to the windres command line, to make sure the output targets x86 (this is important since our SDK only contains x86 DLLs and import libraries).Or you can use 32-bit compilers with MinGW-w64, but don’t ask me how. loonycyborg might know since he obviously managed to build 1.13.2 somehow and he confirmed he’s using MinGW-w64 now.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.