Problem building 8788: animation.cpp.o

Bug #1323483 reported by Julio on 2014-05-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stratagus
Fix Released
Undecided
cybermind

Bug Description

Building 8788 on OS X Mavericks, getting the following error:

...
[ 10%] Building CXX object CMakeFiles/stratagus.dir/src/animation/animation.cpp.o
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8788/src/animation/animation.cpp:216:11: warning:
      implicit conversion of NULL constant to 'char' [-Wnull-conversion]
                        *end = NULL;
                             ~ ^~~~
                               '\0'
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8788/src/animation/animation.cpp:235:20: error:
      use of undeclared identifier 'atoi'
                        return SyncRand(atoi(cur) + 1);
                                        ^
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8788/src/animation/animation.cpp:238:20: error:
      use of undeclared identifier 'atoi'
                        const int min = atoi(cur);
                                        ^
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8788/src/animation/animation.cpp:239:26: error:
      use of undeclared identifier 'atoi'
                        return min + SyncRand(atoi(next + 1) - min + 1);
                                              ^
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8788/src/animation/animation.cpp:247:9: error:
      use of undeclared identifier 'atoi'
        return atoi(parseint);
               ^
1 warning and 4 errors generated.
make[3]: *** [CMakeFiles/stratagus.dir/src/animation/animation.cpp.o] Error 1
make[2]: *** [CMakeFiles/stratagus.dir/all] Error 2
make[1]: *** [CMakeFiles/stratagus.dir/rule] Error 2
make: *** [stratagus] Error 2
Julios-iMac27:build julio$

Related branches

Julio (artofwar) wrote :

As a hack, I added the following to stratagus.h:

#include "stdlib.h"

which got me past the atoi() problem, but then I ran into another problem:

[ 85%] Building CXX object CMakeFiles/stratagus.dir/src/ui/mouse.cpp.o
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8886/src/ui/mouse.cpp:1873:11: error: no member named 'abs' in namespace 'std'; did you
      mean simply 'abs'?
                if (1 < std::abs(CursorStartScreenPos.x - CursorScreenPos.x)
                        ^~~~~~~~
                        abs
/usr/include/stdlib.h:129:6: note: 'abs' declared here
int abs(int) __pure2;
         ^
/Network/Servers/server.private/NetworkUsers/julio/Development/Stratagus_Wargus/stratagus.8886/src/ui/mouse.cpp:1874:11: error: no member named 'abs' in namespace 'std'; did you
      mean simply 'abs'?
                        || 1 < std::abs(CursorStartScreenPos.y - CursorScreenPos.y)) {
                               ^~~~~~~~
                               abs
/usr/include/stdlib.h:129:6: note: 'abs' declared here
int abs(int) __pure2;
         ^

Removing the "std::" from the abs() in ui/mouse.cpp allowed me to finally completely build stratagus (with about a dozen warnings.)

Problems still...

Game starts okay, can navigate menus, can even create a networked game and others can join... HOWEVER... as soon as game starts it crashes. Happens in both multi and single player: as soon as game starts window disappears.

Julio (artofwar) wrote :

In order to see if the crashing of 8886 was due to my new environment, I went back and re-built 8788 and it works fine. So, something happened between 8788 and 8886 which causes a crash as soon as gameplay starts.

cybermind (iddqd-mail) wrote :

What Stratagus game did you use? If it is Wargus, then don't forget to update Wargus scripts from Wargus trunk. I don't have OS X, so I can't reproduce this bug, but on my Windows system Stratagus and Wargus both work perfectly

Julio (artofwar) wrote :

I'm using Wargus.

With the new scripts (1722) I can't even get it to start up (won't even open a window).
With 1680 scripts the game starts up, and let's me choose game (single/multi), but dies on game start.

cybermind (iddqd-mail) wrote :

Please run stratagus with "-p -a" command-line keys (without quotes) and post your stderr.txt/stdout.txt files in both cases

Julio (artofwar) wrote :

Attached are the stderr and stdout files.

cybermind (iddqd-mail) wrote :

Just update your Stratagus to the newest trunk build (revision 8896 at the moment). And when you update Wargus from trunk, update Stratagus too (because newest Wargus may be using featues from the newest Stratagus, in this case, BlizzardSpeed missile property)

Julio (artofwar) wrote :

Updated to latest Stratagus (8897), applied my custom patch for OS X + 2 new additional hacks to stratagus.h and mouse.cpp (detailed above), recompiled, and voila... seems to be working fine! Was able to create networked game, connect, and begin play!

Will let you know more once we've had a chance to play.

Questions:
1. Every time I grab new scripts from Wargus trunk I have to copy "wc2-config.lua" from my old installation into the new scripts folder (otherwise Stratagus crashes instantly)... Since it doesn't appear to change from release to release (isn't even present in scripts folder by default), could we put this in another place?

2. In OS X 10.9.x (and possibly other OS's?) we need #include "stdlib.h" wherever atoi is used. To make things easy I just put this in stratagus.h, but I know this can be fixed in better way... should I submit this as a bug?

3. In OS X 10.9.x (and possibly other OS's?) I'm getting an error in mouse.cpp regarding the use of "std::abs()"... any ideas how to fix that? should I submit this as a bug?

Thanks!
Julio

Joris Dauphin (joris-dauphin) wrote :

For 2./3. Can you try to use `#include "cstdlib"` instead of `#include "stdlib.h"` ?

cybermind (iddqd-mail) wrote :

2, 3 are fixed in rev.8900, try it out.
About 1, wc2-config.lua generates automatically, when you are performing fresh installation of Wargus using WC2 CD. Depending on which CD you have (Tides of Darkness or Beyond the Dark Portal), the installer generates proper wc2-config.lua.
So when you are trying to update data from trunk, use wc2-config.lua from your previour installation.

Changed in stratagus:
status: New → Fix Committed
assignee: nobody → cybermind (iddqd-mail)
Julio (artofwar) wrote :

Confirmed issues 2 and 3 are fixed in 8901... Thank You!

cybermind (iddqd-mail) on 2015-03-19
Changed in stratagus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers