Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Open source program Sunsetter (chess related) doesn't compile

  1. Sep 23, 2013 #1


    User Avatar
    Gold Member

    Hi guys,
    I'm trying to compile an open source program (chess and chess variant engine) under linux but for some reason it doesn't work. I know almost nothing regarding programming so I don't know how to fix the problem. In a chess server I asked some programmers if they knew how to fix the problem and only one could "solve" the problem, but he doesn't want to share his code. He told me he had to tweak the Makefile to allow obsolete compilation or something like that. He said that the code of the program is very archaic, etc.
    I posted the code in github, as well as the error I'm getting when I try to compile in a programming forum. But I've received no reply so far. I'm getting desperate to get this program running. So if you can find how to fix the compilation problem, I'd be very happy.
    Here's the full code: https://github.com/arbolis/Sunsetter-crazyhouse [Broken]
    Here's my post on another forum that explains more details about the error: http://www.programmersheaven.com/mb...in-c++-wont-compile-in-linux/?S=B20000#433564.
    The Makefile by the way is
    Code (Text):
    # Makefile to build sunsetter for linux.
    # -Wall turns on full compiler warnings, only of interest to developers
    # -O1 turns on optimization at a moderate level.
    # -O3 turns on optimization at the highest level. (confuses the debugger though)
    # -g turns on debugging data in the executable.
    # -DNDEBUG turns off assert() debugging in the code
    # CFLAGS for a "release" built, no debugging and highly optimized.
    # uncomment this line to build a debug version.
    # need to type "make clean;make" to get the full effect
    # CFLAGS = -Wall -g -O1 -DDEBUG
    # or this one for a "light debug" version which works well with gdb
    # but is otherwise like the release version.
    CFLAGS = -Wall -g -O1 -DNDEBUG
    # set of flags that produces the best speed on Angrim's
    # Athlon Thunderbird with gcc version egcs-2.91.66
    # CFLAGS = -O3 -march=i486 -DNDEBUG

    OBJECTS = aimoves.o bitboard.o board.o book.o bughouse.o evaluate.o moves.o search.o capture_moves.o check_moves.o interface.o notation.o order_moves.o partner.o quiescense.o tests.o transposition.o validate.o

    # sunsetter is the default target, so either "make" or "make sunsetter" will do
    sunsetter: $(OBJECTS) Makefile
    g++ $(CFLAGS) $(OBJECTS) -o sunsetter

    # so "make clean" will wipe out the files created by a make.
    rm $(OBJECTS)

    # a general purpose dependancy for makeing .o files from .cpp files
    g++ $(CFLAGS) -c $<

    # more detailed dependancies below for a few critical files

    aimoves.o: aimoves.cpp definitions.h variables.h board.h brain.h interface.h
    g++ $(CFLAGS) -c aimoves.cpp -o $@

    board.o: board.cpp board.h brain.h interface.h definitions.h bughouse.h \
    variables.h notation.h
    g++ $(CFLAGS) -c board.cpp -o $@

    bitboard.o: bitboard.cpp board.h bughouse.h interface.h brain.h
    g++ $(CFLAGS) -c bitboard.cpp -o $@

    bughouse.o: bughouse.cpp variables.h definitions.h board.h interface.h bughouse.h brain.h
    g++ $(CFLAGS) -c bughouse.cpp -o $@

    evaluate.o: evaluate.cpp brain.h board.h evaluate.h interface.h
    g++ $(CFLAGS) -c evaluate.cpp -o $@

    interface.o: interface.cpp interface.h variables.h notation.h bughouse.h brain.h board.h
    g++ $(CFLAGS) -c interface.cpp -o $@
    in case if you notice something strange.
    Thanks for any help.
    Last edited by a moderator: May 6, 2017
  2. jcsd
  3. Sep 24, 2013 #2


    User Avatar

    Staff: Mentor

    Not much help here, but compilation of an obscure code can be a nightmare. Note that even if someone will be able to compile it, it still doesn't matter his changes will work for you - it is usually a matter of versions of tools and libraries installed on the computer.
  4. Sep 24, 2013 #3


    User Avatar
    Science Advisor
    Homework Helper

    The "[-fpermissive]" in your error message might be a clue.

    Is that a compiler option? if so try setting it with something like
    CFLAGS = -f permissive
    CFLAGS = -permissive
    CFLAGS = +permissive
    in the makefile. (Check your compiler documentation to find which of those is the right syntax).

    I've no idea what "expected initializer before ‘output’ " means without reading the code - but if you get lucky it might be a knock-on effect from the first problem.
  5. Sep 24, 2013 #4


    User Avatar
    Gold Member

    You are right. I tried the command in the Makefile that worked for the last guy who modified sunsetter's code (back in 2004), namely:
    Code (Text):
    CFLAGS = -O3 -march=i486 -DNDEBUG
    but I got the error
    Code (Text):
    g++ -O3 -march=i486 -DNDEBUG -c aimoves.cpp -o aimoves.o
    aimoves.cpp:1:0: error: CPU you selected does not support x86-64 instruction set
    aimoves.cpp:1:0: error: CPU you selected does not support x86-64 instruction set
    make: *** [aimoves.o] Error 1
    . Actually it seems an error due to my gcc 4.8.1 compiler who can't understand old code or something like that... I guess of course.
    I see. I've checked out on the web and it should be -fpermissive.
    So I modified the first non commented line of the Makefile, I tried many variants with -fpermissive but non worked. For example
    Code (Text):
    CFLAGS = -fpermissive -O3 -march=x86-64 -DNDEBUG
    Code (Text):
    g++ -fpermissive -O3 -march=x86-64 -DNDEBUG -c aimoves.cpp -o aimoves.o
    In file included from aimoves.cpp:19:0:
    board.h:740:21: warning: extra qualification ‘boardStruct::’ on member ‘getColorOnMove’ [-fpermissive]
    board.h:754:21: warning: extra qualification ‘boardStruct::’ on member ‘getColorOffMove’ [-fpermissive]
    In file included from brain.h:20:0,
                     from aimoves.cpp:20:
    interface.h:33:14: error: expected initializer before ‘output’
    make: *** [aimoves.o] Error 1
  6. Sep 24, 2013 #5


    User Avatar
    Science Advisor
    Homework Helper

    It did "work", in that it turned your first two errors into warnings (which you can ignore). But the bad news is, it didn't fix the other one!

    I think you are running out of options, without actually understanding and modifying the code, and it's a bit optimistic to expect somebody to look at that "for free". It might take 10 seconds to fix it, or 10 hours, but there's no way to tell which until you tryi.
  7. Sep 24, 2013 #6


    User Avatar
    Gold Member

    I see... well thanks a lot. I think you're right. Actually a programmer fixed it in a few minutes, I may talk to him soon but there's no guaranty either.
    Meanwhile I posted this "problem" in a chess forum, in hope of someone to overcome the problem. But as you said, for free it will be hard.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook