c++ Need Help Compiling A Makefile

Discussion in 'C++' started by New_Programmer, Mar 31, 2009.

  1. New_Programmer

    New_Programmer New Member

    Joined:
    Mar 31, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hello! I'm just starting to learn c++. I also like to play chess against other people and against computer programs. There is a very famous chess program called Fruit 2.1 that I have been trying to compile the windows version before I edit the source code to change its playing style. You can find the source by googling fruit 2.1 source, its the first thing that comes up:

    I'm using code::blocks IDE and have tried the watcom, borland 5.5, and the gnu gcc compilers to compile the makefile. gnu gcc gives me the least amount of errors, only one error to be exact.

    ***************
    the makefile build log says:

    pv.cpp random.cpp recog.cpp search.cpp search_full.cpp see.cpp sort.cpp square.cpp trans.cpp util.cpp value.cpp vector.cpp > .depend
    mingw32-make.exe: *** No rule to make target `Release'. Stop.
    Process terminated with status 2 (0 minutes, 2 seconds)
    1 errors, 0 warnings

    ***************
    the makefile build messages says:

    Makefile|47|.depend: No such file or directory|
    ||=== Build finished: 1 errors, 0 warnings ===|
    ***************

    the makefile looks like this:

    ==========================================

    # files

    EXE = fruit

    OBJS = attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o \
    move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o \
    option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o \
    search.o search_full.o see.o sort.o square.o trans.o util.o value.o \
    vector.o

    # rules

    all: $(EXE) .depend

    clean:
    $(RM) *.o .depend gmon.out

    # general

    CXX = g++
    CXXFLAGS = -pipe
    LDFLAGS = -lm

    # C++

    CXXFLAGS += -fno-exceptions -fno-rtti

    # optimisation

    CXXFLAGS += -O3 -fstrict-aliasing
    CXXFLAGS += -fomit-frame-pointer
    # CXXFLAGS += -march=athlon-xp # SELECT ME

    # strip

    LDFLAGS += -s

    # dependencies

    $(EXE): $(OBJS)
    $(CXX) $(LDFLAGS) -o $@ $(OBJS)

    .depend:
    $(CXX) -MM $(OBJS:.o=.cpp) > $@

    include .depend
    ==========================================

    could somebody explain to me in the greatest of layman's terms what i have to do to fix this....................................
     
  2. New_Programmer

    New_Programmer New Member

    Joined:
    Mar 31, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Alright, now i'm getting somewhere. I finally compiled the program without the makefile on code::blocks. The program runs fine, but I have some new questions that I hope others can answer.

    A: Why is my compile so slow? I checked all the optimizations I could find in the GNU GCC compiler settings. The downloaded source comes with an executable that runs much faster. Same program but different speeds.

    B: The downloaded executable displays information on the "Arena GUI" (i.e. knodes/second, total nodes evaluated) that my executable does not. Why?

    C: Are all the free compilers that much slower than the commercial compilers? Is so, that is a major bummer. I'll have to buy me an expensive compiler then.
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    A: how long did it take? You've got 33 object files there, so presumably 33 source files; if each takes 10 seconds to compile then that's 330 seconds, i.e. 5.5 min. That's not particularly slow. That's why we have makefiles instead of batch files; a small code update will only result in the affected files being recompiled rather than the whole lot being done as would be the case if you used a batch file instead.

    What hardware are you using? Maybe if you have a slow computer this will affect the time it takes.

    B: no idea, probably this is a compile time option. You may need to specify a define to get that info up.

    C: No, gcc is at least as good as many commercial compilers. Probably you wouldn't notice any difference if you switched to, say, Visual Studio Team Edition, at about £2500 iirc. The problem is likely due to (a) slow hardware and/or (b) unrealistically high expectations. How fast do you think this program should have built and what is that based on? How many lines of code are there in each C file and are you comparing this large application with trivial "hello world" examples that build in about a nanosecond? Compiling code is a major task for a computer and is why developers are usually equipped with the latest and greatest hardware.

    Also if build times are a problem for you and there is a compiled version already available, why not just use that one?
     
  4. New_Programmer

    New_Programmer New Member

    Joined:
    Mar 31, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Sorry, I guess I worded somethings incorrectly and am being misunderstood. Therefore I will repost my questions again. I finally compiled the Fruit 2.1 chess engine source without the makefile using the code::blocks IDE and the GNU GCC compiler. The executable runs fine, but I have some new questions that I hope others can answer.

    A: The downloaded Fruit 2.1 chess engine source comes with an executable that runs much faster than the one I created with the GNU GCC compiler. Why is the executable I created so much slower? I have not modified the source files yet and I tried checking some of the speed optimizations in the GNU GCC compiler settings. The two programs
    do exactly the same thing, but the one I created is much slower.

    B: The downloaded Fruit 2.1 chess engine executable displays information on the "Arena GUI" (i.e. knodes/second, total nodes evaluated) that my executable does not. Why?

    C: Do all commercial IDEs come with some special tools to get the most out of certain compilers? In other words are they able to fully optimize source code to create a better performing executable while those of us who use a free IDE like code::blocks cannot. If so, that is a major bummer because then I'll have to buy me an expensive IDE that can fully optimize and utilize certain c++ compilers.

    Please remember that some of us don't the answers to these questions because we are just learning to program.
     
  5. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    A and B will most likely need to be referred to a Fruit expert; are there any forums associated with the program? At a guess the difference will be that you used different compile-time options and that would explain the differences. The way to solve this would be to find out how the executable you downloaded was built - what exact commands were used, and of course which version of which compiler on which platform. This will all make a difference.

    C in a sense, see A. It depends on what compile flags you use, and commercial compilers won't necessarily optimise better than free ones will. Don't assume that free=crap, find out why there is a slowdown first.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice