ciubotaru/feud

Can't compile on Mac OSX

Closed this issue · 4 comments

so if I run

./configure --prefix=/Users/emanueleianni/personal/feud/compiledgame
make

I have

file.c:8:10: fatal error: 'endian.h' file not found

that can be fixed doing

#include <machine/endian.h>

Once I fixed that I have many warnings like

gcc -c -g -O2 file.c -o file.o
file.c:83:15: warning: implicit declaration of function 'be16toh' is invalid in C99 [-Wimplicit-function-declaration]
        set_gametime(be16toh(year_be), mon);
                     ^
file.c:109:27: warning: implicit declaration of function 'be16toh' is invalid in C99 [-Wimplicit-function-declaration]
        uint16_t nr_characters = be16toh(nr_characters_be);
                                 ^
file.c:165:24: warning: implicit declaration of function 'be16toh' is invalid in C99 [-Wimplicit-function-declaration]
        uint16_t nr_regions = be16toh(nr_regions_be);   /* global var */

and

gcc -g -O2 -o feud map.o character.o dice.o diplomacy.o piece.o time.o file.o window.o voronoi.o world.o feud.o -lncurses -lm
Undefined symbols for architecture x86_64:
  "_be16toh", referenced from:
      _deserialize_game_metadata in file.o
      _deserialize_characterlist in file.o
      _deserialize_regionlist in file.o
      _deserialize_grid in file.o
      _deserialize_pieces in file.o
      _deserialize_feudal in file.o
      _deserialize_heir in file.o
      ...
  "_htobe16", referenced from:
      _serialize_game_metadata in file.o
      _serialize_characterlist in file.o
      _serialize_regionlist in file.o
      _serialize_grid in file.o
      _serialize_pieces in file.o
      _serialize_feudal in file.o
      _serialize_heir in file.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [feud] Error 1

Thank you for the bug report. Apparently, this is a common problem on Mac OS X and Windows. A quick fix is provided in branch issue1, but I have no Mac machines to test it.

@invasionofsmallcubes, could you please try to compile from branch "issue1" and share your results?

I got this

➜  feud git:(issue1) ✗ make                                                                
gcc -c -g -O2 file.c -o file.o
gcc -g -O2 -o feud map.o character.o dice.o diplomacy.o piece.o time.o file.o window.o voronoi.o world.o feud.o -lncurses -lm
gcc -c -g -O2 -o editor.o editor.c
gcc -g -O2 -o feud-editor map.o character.o dice.o diplomacy.o piece.o time.o file.o window.o voronoi.o world.o editor.o -lncurses -lm
gcc -c -g -O2 -o ai.o ai.c
gcc -g -O2 -o feud-ai map.o character.o dice.o diplomacy.o piece.o time.o file.o window.o voronoi.o world.o ai.o -lncurses -lm
gcc -c -g -O2 -o server.o server.c
gcc -g -O2 -o feud-server map.o character.o dice.o diplomacy.o piece.o time.o file.o window.o voronoi.o world.o server.o -lncurses -lm

And then

  feud git:(issue1) ✗ ./feud
Cannot open saved game. Exiting...

OK, it compiled successfully!

Now, to play the game, you need to create a world. One way is to first run "./feud-editor", choose "Create game" and follow the instructions. Another way is to copy an existing world into your home directory (cp maps/feud-1.sav ~/.feud/feud.sav) and then run "./feud".

I will update the README to make it more clear.