READ THIS if you want to build from source on Windows!

For discussion of the code running behind the game

Moderator: Staff

rujasu
Developer
Posts: 758
Joined: Sun Feb 25, 2007 5:40 am
Location: Maryland, USA

READ THIS if you want to build from source on Windows!

Postby rujasu » Sat May 14, 2011 9:39 pm

This process should work for the latest SVN of Allacrost.

You will need the Code::Blocks IDE set up with a working MinGW installation. The version of MinGW that comes bundled with the IDE may or may not work, but anything 4.4 or later should work fine.

You will need the most recent Allacrost dependency archive. As of right now, that is found here:

http://www.allacrost.org/staff/user/ruj ... ay2011.zip

Check out the current SVN trunk (instructions). Unzip the dependency file into the "game" directory, so that it now contains an "allacrost-win32-depends" directory in addition to dat, doc, img, mus, src, et cetera.

Open "allacrost.workspace" in Code::Blocks, make sure the target is set to "Debug Win32" or "Release Win32," and build the Allacrost project. Find something to occupy your time, as the initial build will take a while. Once this is finished, assuming there are no errors you should be able to run the program. Note that the Map Editor project does not currently build on Code::Blocks -- we're working on it. If a Windows build of the editor is needed, it must be cross-compiled from Linux using MinGW.

(We will work to improve this page and keep it up-to-date as needed.)
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Sat May 14, 2011 10:00 pm

Nice. :approve:


On a tangential topic, we should probably have a stickied thread in this forum giving instructions on how to compile the game and editor for all systems. This information is in the wiki (sort of incomplete though) so we could link there and maybe also use the sticky thread for people to post compilation issues in. :shrug:
Image
nemesis
Senior Member
Posts: 157
Joined: Fri Apr 29, 2011 7:53 am
Location: Sachsen/Germany

Re: READ THIS if you want to build from source on Windows!

Postby nemesis » Mon May 16, 2011 9:05 am

Thanks for this. Works...
blDraX
Newbie
Posts: 5
Joined: Sun Jun 19, 2011 12:48 pm

Re: READ THIS if you want to build from source on Windows!

Postby blDraX » Sun Jun 19, 2011 4:49 pm

I just did this and it works quite well so far.

However, somehow I wasn't successful with the newest version of MinGW (I downloaded the mingw-get-inst and installed it with this - did I do anything wrong here?). Most of the cpp-files seemed to compile correctly but when the 'defs_modes.cpp' was reached, the compiler crashed every time, and I mean really crashed ("cc1plus.exe has stopped working" windows error message). I tested this on my main computer as well as on my notebook, both are Windows 7 64bit systems and on both system the compiling process was canceled because of that error.

I tried to find a solution for that but wasn't able to find anything on the internet. I finally decided to just try it with the version of MinGW that came with Code::Blocks IDE and everything compiled without any problem.
rujasu
Developer
Posts: 758
Joined: Sun Feb 25, 2007 5:40 am
Location: Maryland, USA

Re: READ THIS if you want to build from source on Windows!

Postby rujasu » Tue Jun 21, 2011 2:54 am

Yeah, MinGW 4.5 has problems for some reason. Use 4.4 or earlier for now. Thanks for trying it out! :)
eyohansa
Newbie
Posts: 3
Joined: Sat Jan 31, 2015 5:17 am

Re: READ THIS if you want to build from source on Windows!

Postby eyohansa » Wed Feb 04, 2015 1:18 pm

Since Code::Blocks is mentioned here, is there any special thing I have to do so I can print out the debug message in Code::Blocks when I run the game with "-d <mode>"?

I have set "-d all" as target parameter and when I run the game, the debug messages still wouldn't come out. Trying to run outside of Code::Blocks brings out bunch of linker issues.
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Wed Feb 04, 2015 6:02 pm

Are you executing the application from a command line? If you aren't (ie you are double-clicking the executable in windows explorer or whatever) then you won't see the debug messages because you have no console that they can be outputted to. The messages are written to cout/cerr, just like a command-line program. We don't have anything fancier than that I'm afraid.
Image
MinionProcyk
Newbie
Posts: 4
Joined: Tue Jun 23, 2015 5:56 pm

Re: READ THIS if you want to build from source on Windows!

Postby MinionProcyk » Tue Jun 23, 2015 7:14 pm

When i go to compile allacrost in code::blocks i get a nice list of 'no such file or directory'. Usually you'd only see this if you created a symbolic link instead having the actual file, but it is present in the file explorer. I tried to build the project in visual studio as well and i get a nice list of 'file not found'.

I'm not sure how to get past this, but I'm looking into it.
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Tue Jun 23, 2015 9:41 pm

Are all the files Allacrost files, or are they files missing from the libraries? Note that you should be compiling from the "game" directory in the repository. The "demo" directory is all old stuff from the years where we produced short RPG demos (which I'm considering moving into a separate branch so it's not in the way).


Also as a side note, now that we have a Mercurial repository it might make sense to create a separate branch to store our Windows and OS X library files, since it's pretty hard to find the link to these libraries unless you manage to find this thread and the link rujasu added to download them.
Image
MinionProcyk
Newbie
Posts: 4
Joined: Tue Jun 23, 2015 5:56 pm

Re: READ THIS if you want to build from source on Windows!

Postby MinionProcyk » Tue Jun 23, 2015 10:41 pm

I am indeed compiling from the 'game' directory and not the 'demo' directory. It seems like there are missing libraries. I have the win32 dependencies in the game folder, in its own directory called win32dependencies, but, for example, there seems to be no folder called 'config' where the compiler is looking for /boost/config/select_compiler_config.hpp.
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Tue Jun 23, 2015 11:54 pm

The top post says that the libraries should be in a folder called "allacrost-win32-depends", not "win32dependcies". The top post was written four years ago so I'm not sure if it's still correct about that, but if it is it would explain a lot. The build project is looking in that directory for the libraries, not finding them (since your library folder is called something else) and the errors are the result. Look at the build project/file and see if you can figure out if it's looking for the libraries in a directory by that name, or some other directory.
Image
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Mon Jun 29, 2015 12:03 am

I followed the instructions in the first post and managed to build it successfully on Windows tonight from the latest source. Steps were:

1) Install minGW and make sure to check to install the gcc/g++ compiler
2) Install the version of CodeBlocks with mingw in the install filename
3) Install tortoisehg and use it to grab the latest source by cloning the master repository
4) Download the dependencies package linked in the first task and make sure to extract the contents to the base directory (game/) and have that folder called "allacrost-win32-depends"
5) Navigate to the repository directory, open the allacrost.workspace file in Code::Blocks, and select
6) In Code::Blocks, check Build -> Select Target -> Release Build, then select Build -> Build
7) Select Build -> Run and the game will start

I haven't tested with building the editor yet. I did run into a problem where if I tried to double click the "AllacrostWin.exe" file that was created, it complained about not having intl.dll on my system. That's a DLL required for gettext, and I checked and the DLL is indeed in the allacrost-win32-depends directory, so I don't know what's up with that. But I have confirmed that if you follow the instructions, you can get the Windows build working on your system. FYI: This is the first time I've ever attempted to build Allacrost on Windows.

EDIT
I got the binary to run outside of Code::Blocks by moving all the DLL files to the same directory as the .exe. Not an ideal solution, and someone in the future needs to figure out what needs to change in the build files so that it finds the DLLs in the allacrost-win32-depends directory.
Image
Lordakius
Junior Member
Posts: 26
Joined: Thu May 26, 2016 9:22 pm

Re: READ THIS if you want to build from source on Windows!

Postby Lordakius » Mon Jul 25, 2016 12:54 pm

So far, I have worked only with the Microsoft Visual Studio IDE and I will try to build Allacrost within the next week when I have got some time (and when it is not so warm anymore :angel: ).

When trying to build Allacrost (Build->Build Solution/Allacrost) I get several error messages that different files could not be found.

e.g.

Code: Select all

1>c1xx : fatal error C1083: Cannot open source file: 'src\global\global_objects.cpp': No such file or directory
1>  global_effects.cpp
1>c1xx : fatal error C1083: Cannot open source file: 'src\global\global_effects.cpp': No such file or directory


I have looked trough my directory and realized, that I don't have 'src/global'. May be that my local repository is broken?

Code: Select all

1>c:\users\lordakius\desktop\hoa\mercurial local repository\game\src\engine\video\video.h(50): fatal error C1083: Cannot open include file: 'png.h': No such file or directory
1>  texture_controller.cpp
1>c:\users\lordakius\desktop\hoa\mercurial local repository\game\src\engine\video\video.h(50): fatal error C1083: Cannot open include file: 'png.h': No such file or directory
1>  texture.cpp


the other kind of error message is obviously about a missing included file. Same suggestion as above.

I will try to build Allacrost via the given way from Roots. If this should not work I may reload the repository from the server. Any other ideas ?

Off-topic: it is possible to put lines into a spoiler here? Would be better for longer lines of codes.
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Mon Jul 25, 2016 1:16 pm

The Visual Studio build files have not been updated in forever, so I'm not surprised it didn't work right out of the gate. No, your local repository is not broken. We used to have all the global code in src/global, but a while back we moved this code to src/common/global. png.h is a header from a library file (libpng) that Allacrost uses to build, so you either don't have that library installed anywhere or it's not finding it correctly (look to the top post for a zip file containing all the libraries you need).

I don't think we have a spoiler tag on the forums. Might be something useful to add.
Image
Lordakius
Junior Member
Posts: 26
Joined: Thu May 26, 2016 9:22 pm

Re: READ THIS if you want to build from source on Windows!

Postby Lordakius » Mon Jul 25, 2016 1:29 pm

I have downloaded the zip before but it did not changed the outcome :/

So, to make that work I have to remake all the headers and stuff in the files?
Sounds like cool work to me^^ I'll do that when updating the headers of the menu files.

With that spoiler thing: Do we need a special kind of module there or do we program that ourselves?
I would like to do that, too (or at least work on that :hack: ).

*edit:

Code: Select all

1>  utils.cpp
2>  MOC dialog_boxes.h
2>  Der Befehl "moc" ist entweder falsch geschrieben oder
2>  konnte nicht gefunden werden.


Another line of the error (didn't saw it before because it was at the beginning)
Translation:"The command "moc" is either written wrong or could not be found"
Is this Meta-Object Compiler linux only? Or do I miss there some libs from Windows, too? ^^

*edit²:

lua.h / unistd.h / al.h / SDL/SDL.h

are these as well in the downloadable zip ?
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Mon Jul 25, 2016 3:01 pm

Yes, you need to update the build files with all the missing and moved files. There's going to be quite a number of them, as there's been a ton of code written since the last time this was compiled in Visual Studio by anyone.

The spoiler thing would be a phpBB extension. I'm sure one already exists. I just need to find it and install it.

"moc" is a program used by the QT library as kind of a pre-compiler, and is necessary for building the editor. If you want, you can ignore that for now as anything in src/editor uses QT, and you don't need to build the editor to build the game.

All of those header files you mentioned are in the zip package, although I don't know about unistd.h.

----

Again, I just want to remind you that setting all this up in Visual Studio is the "hard path". The easy path is to use Code::Blocks. I was able to compile in Windows last year with Code::Blocks and I left a post in this thread detailing every step I took. If you want to use VS and its build system, by all means go for it. But it will take longer figuring out how to get it to work there than using the easy path. Also I've never used VS before, so you're pretty much on your own as far as figuring out the build setup.

You might want to take a look at Valyria Tear's build files as it seems they do have VS support. Valyria Tear is a fork off of Allacrost, so we share a lot of the same code and files. The README.md file (scroll down on the page) contains notes about compiling on Windows with VS.

https://github.com/ValyriaTear/ValyriaTear
Image
Lordakius
Junior Member
Posts: 26
Joined: Thu May 26, 2016 9:22 pm

Re: READ THIS if you want to build from source on Windows!

Postby Lordakius » Mon Jul 25, 2016 3:06 pm

Yeah, as I thought, it seems like a bunch of work there. Maybe I will do that just that we have it, but I'll go with Code::Blocks for now, so I may do some direct work first :)
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Sun Sep 04, 2016 12:24 am

Just now I committed some changes that should help Windows developers.

1) Added a new file, lib/win32.zip. This contains all the dependencies that you formerly had to grab from this forum thread and extract to your system. Now its already setup so a user just has to extract the contents of the .zip to the current directory directly from their source download.

2) Updated the Code::Blocks project files for Windows. Now instead of looking for allacrost-win32-depends for all the dependencies, it looks in lib/win32. I also changed some build options and set the target to allacrost.exe or allacrost-debug.exe. Build files are now outputed in build/allacrost or build/allacrost-debug


I'm going to update the wiki page for compilation instructions when I get a chance. I'm also going to close up this thread soon, and replace it with a new sticky thread to cover any and all compilation issues (so we don't get so many different threads on this forum about similar problems).


There are still further things I want us to do for the Windows build files. Don't know when I'll get around to this, but if someone else wants to take charge be my guest. :hack:

A) Remove the Map_Editor.cbp file. I see no reason why we need two different project files when we can just add the editor as a target within the Allacrost.cbp file.

B) Figure out what changes are needed to get the editor to compile on Windows. We might be missing some QT libraries that we will have to update in the new .zip file.

C) Figure out DLL paths. I don't want to have to copy all the .dll files in lib/win32/lib to the base directory to run the game. I've been doing some research on how to specify the DLL path for Windows and tried a couple things, but so far I haven't had any luck.
Image
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: READ THIS if you want to build from source on Windows!

Postby Roots » Sun Sep 04, 2016 4:06 am

Thread is now locked. Please head to this thread in the technical issues forum to report future compilation issues.
Image

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 4 guests