Problem Building on Windows (r2105)

For discussion of the code running behind the game

Moderator: Staff

RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Problem Building on Windows (r2105)

Postby RyanBrowne » Tue Dec 09, 2014 2:02 am

(I'm not super familiar with building C++ projects if any of this sounds a bit newbie ;) )

Followed the instructions in the stickies to download and install Code::Blocks as well as the Allacrost dependency libraries, had to manually add the "-std=c++11" option to the compilers flag options, and then am still getting build errors, different depending on whether I try a "debug win32" or a "release win32" build.

For Debug win32:

Code: Select all

||=== Build: Debug Win32 in Allacrost (compiler: GNU GCC Compiler) ===|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\defs.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\defs_engine.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\modes\battle\battle_events.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\modes\defs_modes.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\common\global\defs_global.cpp|
 Allacrost-Debug\src\defs.o||No such file or directory|
 Allacrost-Debug\src\engine\defs_engine.o||No such file or directory|
 Allacrost-Debug\src\modes\battle\battle_events.o||No such file or directory|
 Allacrost-Debug\src\modes\defs_modes.o||No such file or directory|
 Allacrost-Debug\src\common\global\defs_global.o||No such file or directory|
||=== Build failed: 5 error(s), 5 warning(s) (0 minute(s), 0 second(s)) ===|

Which from my limited knowledge sounds like I might need to edit makefile settings or something, but I'm not sure what to try

On the release win32 build:

Code: Select all

||=== Build: Release Win32 in Allacrost (compiler: GNU GCC Compiler) ===|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\defs.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\defs_engine.cpp|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\system.cpp||In member function 'virtual bool hoa_system::SystemEngine::SingletonInitialize()':|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\system.cpp|263|error: '_MAX_PATH' was not declared in this scope|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\system.cpp|265|error: 'buffer' was not declared in this scope|
||=== Build failed: 2 error(s), 2 warning(s) (0 minute(s), 0 second(s)) ===|


The code in question is:

Code: Select all

bool SystemEngine::SingletonInitialize() {
   // Initialize the gettext library
   setlocale(LC_ALL, "");
   setlocale(LC_NUMERIC, "C");

   #if defined(_WIN32) || defined(__MACH__)
      char buffer[PATH_MAX];
      // Get the current working directory.
      string cwd(getcwd(buffer, PATH_MAX));
      cwd.append("/translations/");
      bindtextdomain("allacrost", cwd.c_str());
      bind_textdomain_codeset("allacrost", "UTF-8");
      textdomain("allacrost");
   #elif (defined(__linux__) || defined(__FreeBSD__)) && !defined(RELEASE_BUILD)
      // Look for translation files in LOCALEDIR only if they are not available in the current directory.
      if (ifstream("lua/data/config/settings.lua") == NULL) {
         bindtextdomain(PACKAGE, LOCALEDIR);
         bind_textdomain_codeset(PACKAGE, "UTF-8");
         textdomain(PACKAGE);
      }
      else {
         char buffer[PATH_MAX];
         // Get the current working directory.
         string cwd(getcwd(buffer, PATH_MAX));
         cwd.append("/txt/");
         bindtextdomain(PACKAGE, cwd.c_str());
         bind_textdomain_codeset(PACKAGE, "UTF-8");
         textdomain(PACKAGE);
      }
   #else
      bindtextdomain(PACKAGE, LOCALEDIR);
      bind_textdomain_codeset(PACKAGE, "UTF-8");
      textdomain(PACKAGE);
   #endif

   // Called here to set the default English language to use nice quote characters.
   SetLanguage("en@quot");

   return true;
}


Which I'm guessing is something to do with me specifically trying to build this on win32 instead of linux



Hopefully someone can point me in the right direction to finishing the build on my system
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Tue Dec 09, 2014 2:12 am

The warnings you are getting about file timestamps are happening because those files no longer exist. You should remove them from the project build files.

The errors I'm not sure about. That particular section of the code is initializing the gettext library, so you may want to refer to its documentation to see what's going on there. I've never seen PATH_MAX anywhere. You can clearly see that there is different codepaths for initializing on Windows versus Linux. I did a search for the variable names its complaining about and here's what came up:

Code: Select all

olsent@harima:~/dev/allacrost/trunk/game$ grep -nir PATH_MAX *
src/engine/system.cpp:20:   #ifndef PATH_MAX
src/engine/system.cpp:21:   #define PATH_MAX _MAX_PATH   // redefine _MAX_PATH to be compatible with Darwin's PATH_MAX
src/engine/system.cpp:263:      char buffer[PATH_MAX];
src/engine/system.cpp:265:      string cwd(getcwd(buffer, PATH_MAX));
src/engine/system.cpp:278:         char buffer[PATH_MAX];
src/engine/system.cpp:280:         string cwd(getcwd(buffer, PATH_MAX));
olsent@harima:~/dev/allacrost/trunk/game$ grep -nir MAX_PATH src/engine/system.*
src/engine/system.cpp:19:   #include <stdlib.h>          // defines _MAX_PATH constant
src/engine/system.cpp:21:   #define PATH_MAX _MAX_PATH   // redefine _MAX_PATH to be compatible with Darwin's PATH_MAX



Sorry I can't be more helpful than that right now. If you still can't figure out what's going on, post here again and I'll have a closer look.
Image
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Tue Dec 09, 2014 3:34 am

Ok, cleaned up the warnings easily enough, been trying to dig around a bit more "MAX_PATH" is defined in limits.h which is found in the mingw-runtime-package as

Code: Select all

/*
 * File system limits
 *
 * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the
 *       same as FILENAME_MAX and FOPEN_MAX from stdio.h?
 * NOTE: PATH_MAX is the POSIX equivalent for Microsoft's MAX_PATH; the two
 *       are semantically identical, with a limit of 259 characters for the
 *       path name, plus one for a terminating NUL, for a total of 260.
 */
#define PATH_MAX   260

I'm wondering if this is a mingw problem? The version I have installed is through Code::Blocks but I know very little about it
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Tue Dec 09, 2014 5:04 am

Try adding the line: "#include <limits.h>" in system.cpp around line 20, just before the "#infdef PATH_MAX".

What's happening is that PATH_MAX is not defined on your system because, apparently, its in a header file that we're not including. So instead what the code does is try to defined PATH_MAX using the variable name _MAX_PATH, which also doesn't exist in any of the files being included. I'm not sure why (maybe _MAX_PATH was removed or moved to a different file). Regardless, this should be an error that is easy enough for us to get around, even if its in a slightly hackish way.


If adding the "#include <limits.h>" line doesn't fix your problem, instead use "#define PATH_MAX 260". That should definitely resolve it.
Image
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Tue Dec 09, 2014 6:21 am

Yes, that definitely worked, just adding "#include <limits.h>" to system.cpp has let the build continue.

Now I'm starting to feel a bit bad here (as though I'm playing whack a mole), but now that my compile gets passed that we're on to the next error. This time we're in \engine\video\particle_manager.cpp

Code: Select all

||=== Build: Debug Win32 in Allacrost (compiler: GNU GCC Compiler) ===|
src\luabind\luabind\detail\policy.hpp|211|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|264|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|316|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|372|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|418|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|470|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|514|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|597|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|772|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\detail\policy.hpp|823|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
src\luabind\luabind\adopt_policy.hpp|55|warning: type qualifiers ignored on function return type [-Wignored-qualifiers]|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\video\particle_manager.cpp||In member function 'hoa_video::ParticleEffectDef* hoa_video::private_video::ParticleManager::LoadEffect(const string&)':|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\video\particle_manager.cpp|98|error: 'stricmp' was not declared in this scope|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\video\particle_manager.cpp|124|error: 'stricmp' was not declared in this scope|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\video\particle_manager.cpp|139|error: 'stricmp' was not declared in this scope|
C:\Users\Ryan\Documents\Allacrost\code\game\src\engine\video\particle_manager.cpp|272|error: 'stricmp' was not declared in this scope|
||=== Build failed: 4 error(s), 11 warning(s) (0 minute(s), 2 second(s)) ===|



My initial google-fu tells me that my library is adhering to strict posix or ansi standard library functions which do not allow stricmp (case sensitive version of strcmp) with solutions around overriding stricmp with strcasecmp depending on your OS
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Tue Dec 09, 2014 6:34 am

No worries. The Windows build hasn't been updated in quite a long time and I've made some pretty radical changes in the last couple of months. I expect we'll continue running into more tricky errors for a while.

The next error you've run into occurs in a very old file that hasn't been updated in a very long time. There's actually no "stricmp" call in the code. I'm looking at it and we call "strcasecmp", so I'm guessing that your libraries are just calling stricmp within that function. Looking at this code, It doesn't really make sense for us to call strcasecmp in the first place as far as I'm concerned. What its doing is reading data from a number of variables in a Lua file and checking their value with a case insensitive string match. I don't really think its necessary to do that (the case insensitive matching part). I don't have a good idea for how to fix this, so I think you should just go through the file and remove all calls to strcasecmp. For example, here's a couple lines:

Code: Select all

      if (strcasecmp(shape_string.c_str(), "point") != 0)
         system_definition->emitter._shape = EMITTER_SHAPE_POINT;


Change it to this:

Code: Select all

      if (shape_string == "point")
         system_definition->emitter._shape = EMITTER_SHAPE_POINT;



This is technically different behavior, but the != 0 condition used previously doesn't make sense, so I think this is a bug. This code isn't being used anywhere in the game currently, so that's not entirely unexpected. There's several of these strcasecmp calls in this file, so make sure to change them all. Good job on finding your first bug. ;)
Image
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Wed Dec 10, 2014 12:56 am

Heh heh all right, well I'm fine with continuing to work through these then as long as you are.

I made the edits to 4 sections of if/else code in that file just changing the if condition to the format you gave me and the build continued past that point.

Code: Select all

||=== Build: Debug Win32 in Allacrost (compiler: GNU GCC Compiler) ===|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\modes\battle\battle_events.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\modes\defs_modes.cpp|
||WARNING: Can't read file's timestamp: C:\Users\Ryan\Documents\Allacrost\code\game\src\common\global\defs_global.cpp|
 Allacrost-Debug\src\modes\battle\battle_events.o||No such file or directory|
 Allacrost-Debug\src\modes\defs_modes.o||No such file or directory|
 Allacrost-Debug\src\common\global\defs_global.o||No such file or directory|
||=== Build failed: 3 error(s), 3 warning(s) (0 minute(s), 0 second(s)) ===|



After that build I deleted the references to those files from the workspace and continued for a much longer time until we got to this error:

Code: Select all

||=== Build: Debug Win32 in Allacrost (compiler: GNU GCC Compiler) ===|
Allacrost-Debug\src\main.o:main.cpp|| undefined reference to `hoa_defs::BindEngineCode()'|
Allacrost-Debug\src\main.o:main.cpp|| undefined reference to `hoa_defs::BindCommonCode()'|
Allacrost-Debug\src\main.o:main.cpp|| undefined reference to `hoa_defs::BindModeCode()'|
Allacrost-Debug\src\main.o:main.cpp|| undefined reference to `hoa_test::TestMode::TestMode()'|
Allacrost-Debug\src\main.o:main.cpp|| undefined reference to `hoa_test::TestMode::TestMode(unsigned int)'|
Allacrost-Debug\src\main_options.o:main_options.cpp|| undefined reference to `hoa_test::TEST_DEBUG'|
Allacrost-Debug\src\main_options.o:main_options.cpp|| undefined reference to `hoa_test::TEST_DEBUG'|
Allacrost-Debug\src\main_options.o:main_options.cpp|| undefined reference to `hoa_test::TEST_DEBUG'|
Allacrost-Debug\src\modes\battle\battle.o:battle.cpp|| undefined reference to `hoa_battle::private_battle::SequenceSupervisor::SequenceSupervisor(hoa_battle::BattleMode*)'|
Allacrost-Debug\src\modes\battle\battle.o:battle.cpp|| undefined reference to `hoa_battle::private_battle::SequenceSupervisor::~SequenceSupervisor()'|
Allacrost-Debug\src\modes\battle\battle.o:battle.cpp|| undefined reference to `hoa_battle::private_battle::SequenceSupervisor::Update()'|
Allacrost-Debug\src\modes\battle\battle.o:battle.cpp|| undefined reference to `hoa_battle::private_battle::SequenceSupervisor::Draw()'|
Allacrost-Debug\src\modes\boot\boot.o:boot.cpp|| undefined reference to `hoa_test::TestMode::TestMode()'|
||=== Build failed: 13 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Wed Dec 10, 2014 1:06 am

It looks like its not finding data from files that were added recently, and is complaining about not finding files from files that have been removed. Can you try cleaning the entire build (make clean if you have such a command, otherwise just try removing all .o files). Check to make sure that all the source files are listed in the build files (it looks like you're missing src/modes/test.h and test.cpp, for example). Then start the build process over from a clean slate.

Open the file Makefile.am and compare that with what your build files contain. Every file that is currently used in the Allacrost build is listed in this file, and it does not contain references to any deleted files. If there are any source files used within Makefile.am that are not in your build files, add them. If your build file references files that are not found in Makefile.am, remove them (they shouldn't be in the source tree either).


I'm hanging out in our IRC channel tonight if you want more direct help. I appreciate you suffering through this part. Don't worry, because you should only have to go through this once (and as long as the build files stay updated, others who join won't have to share your pain). :angel:
Image
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Wed Dec 10, 2014 2:59 am

Yeah I've been cleaning before building when I remove files from the project.

I can confirm files like src/modes/test.h and test.cpp exist in the filesystem and not the project files.

I guess I'm going to have to manually go through each directory in the project view and add files as I see them missing from Makefile.am, I'll let you know how that goes once I think I've got them all lol
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Wed Dec 10, 2014 3:18 am

And we now build successfully! (as far as I can tell anyway), the game seems to run at least ;)

I'd say about 10ish files were missing in my build, mostly from /modes/shop, but a smattering of them here and there
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Wed Dec 10, 2014 5:11 am

Woohoo! Glad to hear we're done with that. Yeah, its a pain when a build file has been left stagnant for so long. Working on a cross-platform project, its bound to happen. In the SVN commit thread, I always note when I made a change to the build files on Linux and note that other project build files need to make the same change.

Now that that's over with, we should get you to commit the code changes that you made and upload the updated build files. Let me know what your Sourceforge name is and I will grant you commit access. Can you also create a patch diff and post it here just so I can take a look? We have a policy to review every developers first commit just to make sure that they didn't do anything crazy (when we didn't do this in the past, sometimes someone would come along and make a mess right away). You can attach the updated build files here, since I don't think that the Windows build files are in the repository (not sure why not). I'll make sure that the package in the Windows build thread gets updated.

After that, when you're ready to start working on your first assignments, let me know and we can talk about where to start you. :approve:
Image
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Wed Dec 10, 2014 6:40 am

Ok, should be a diff patch uploaded with this post, first time I've really made one of these so let me know if I did something wrong, kind of interesting reading through them, can actually see my workflow as I cut/pasted and commented out the old code.

My sourceforge profile is conveniently:
https://sourceforge.net/u/ryanbrowne/profile/

Do you know specifically which files contain the win32 build information? When I loaded the project through Code::Blocks I opened /code/game/allacrost.workspace to get where I started, but I'm pretty sure that's not the file that tracks the buildfiles
Attachments
.patch
win32 edits diff patch
(7.18 KiB) Downloaded 151 times
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Wed Dec 10, 2014 6:59 am

Awesome. Commit looks good with one exception. Make sure you remove all the old strcasecmp lines that you commented out. If for some reason we need to revert back to using them in the future, they are saved in the commit history so there's no need to leave them inactive in the current code like that. Ah, so I took a look and I guess the Code::Blocks build files are in the repository after all. I think that you must have edited Allacrost.cbp (and maybe also Map_Editor.cbp if you got the editor working). Those files should be updated with your commit I think. The zip file rujasu linked to in the Windows build thread was just an archive of all the libraries needed to compile the game.

I've given you commit access, so when you've made that change go ahead and make your first commit. After you do, make sure you post to the commit log thread with details about what files you changed and what your changes include. If you're using Windows, TortoiseSVN is probably the best tool for the job. On Linux I just use svn from the command line. Before every commit, I run `svn status` to get a list of all my changed files and copy that list to the commit post I make on the forums.

Hope that all makes sense.
Image
RyanBrowne
Newbie
Posts: 8
Joined: Mon Dec 08, 2014 10:07 pm

Re: Problem Building on Windows (r2105)

Postby RyanBrowne » Wed Dec 10, 2014 7:06 am

Yeah no problem, I just didn't want to remove anything on my first edit, easy thing to change.

I haven't really looked at the map editor yet, figured I'd just stick to one task at a time, I'll see if I can get that to build later as well then.

Yeah I've been using TortoiseSVN up to this point, I'll probably wait till tomorrow (getting late) to commit/write up a proper post then.
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Problem Building on Windows (r2105)

Postby Roots » Wed Dec 10, 2014 7:38 am

Cool. Yeah, you can put off trying to build the editor because I'm sure you're tired of messing around with build files by now. Plus the editor is undergoing a lot of changes right now, so you might want to wait a couple weeks until its a bit less volatile.
Image

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 5 guests