compiling StockFish

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

UncombedCoconut
Posts: 319
Joined: Fri Dec 18, 2009 11:40 am
Location: Naperville, IL

Re: compiling StockFish

Post by UncombedCoconut »

Sven Schüle wrote:UNIX shell trap ...
Depressingly, you are right!
What I find strangest is that both orders are equivalent if you are trying to funnel both file descriptors through a pipe rather than direct them to the same file. For instance:

Code: Select all

justinb@malibu:~$ sh -c 'echo Hello > /dev/stderr; echo world > /dev/stdout' 2>&1 > didJustinScrewUp; nl didJustinScrewUp
Hello
     1	world
justinb@malibu:~$ sh -c 'echo Hello > /dev/stderr; echo world > /dev/stdout' 2>&1 | nl
     1	Hello
     2	world
This strengthens my wish that before I die I'll see a truly useful "legacy" system which doesn't preserve crazy bugs for compatibility's sake. But at least I can now stump my friends with puzzles about when "|cat" is not a no-op. :)
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: compiling StockFish

Post by lucasart »

UncombedCoconut wrote: And an attempt to explain make:
Stockfish's Makefile includes a lot of code to decide on compiler flags. Yet its core job is simple: build each object after its dependencies. It differs as follows from a "g++ [flags] *.cpp" command:
* It compiles the source files, separately, until it has up-to-date object code for each file. It passes "-c" to g++, which tells it to output an (incomplete) object file (named by the "-o filename.o" flag).
* Once the object files are ready, it passes all of them to g++ to be linked. The "-o stockfish" flag tells g++ to create an output file named "stockfish" in the current directory (/home/lucas/Downloads/src)

Because make compiles your source files separately, and only when they change, it is an enormous time-saver for developers of projects with many source files. As such, I strongly suggest that you use it in your own project. You will quickly recover the time invested in learning it. :)

HTH
Ah... you guys are probably right! There I was, just wanting to program a chess engine for fun, and now I need to learn make, git, and the shell basics that I still lack (redirecting stderr for one).
UncombedCoconut
Posts: 319
Joined: Fri Dec 18, 2009 11:40 am
Location: Naperville, IL

Re: compiling StockFish

Post by UncombedCoconut »

I suppose you could alternatively tie your engine's build process to a specific IDE. :)
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: compiling StockFish

Post by lucasart »

UncombedCoconut wrote:I suppose you could alternatively tie your engine's build process to a specific IDE. :)
Oh no, I want to make an UCI one. Besides, I don't want to go through the pain of doing a GUI. What I need to do is an UCI interface that allows matches between engines in an industralised way. I can't find any good UCI interface on Linux, they're all Internet Chess oriented not Computer chess oriented if you like.

All I want is a simple command line tool, that takes 2 engines, does matches between them and writes a PGN out of it. Does anyone know if such a program exists (on Linux) ?
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: compiling StockFish

Post by zamar »

lucasart wrote:
UncombedCoconut wrote:I suppose you could alternatively tie your engine's build process to a specific IDE. :)
Oh no, I want to make an UCI one. Besides, I don't want to go through the pain of doing a GUI. What I need to do is an UCI interface that allows matches between engines in an industralised way. I can't find any good UCI interface on Linux, they're all Internet Chess oriented not Computer chess oriented if you like.

All I want is a simple command line tool, that takes 2 engines, does matches between them and writes a PGN out of it. Does anyone know if such a program exists (on Linux) ?
Cutechess-cli
Xboard+polyglot
Joona Kiiski
UncombedCoconut
Posts: 319
Joined: Fri Dec 18, 2009 11:40 am
Location: Naperville, IL

Re: compiling StockFish

Post by UncombedCoconut »

lucasart wrote:
UncombedCoconut wrote:I suppose you could alternatively tie your engine's build process to a specific IDE. :)
Oh no, I want to make an UCI one. Besides, I don't want to go through the pain of doing a GUI.
IDE doesn't mean GUI; it would just let you create a "project" rather than a makefile. The distinction would be how you compile; the program would be identical.
What I need to do is an UCI interface that allows matches between engines in an industralised way. I can't find any good UCI interface on Linux, they're all Internet Chess oriented not Computer chess oriented if you like.

All I want is a simple command line tool, that takes 2 engines, does matches between them and writes a PGN out of it. Does anyone know if such a program exists (on Linux) ?
cutechess-cli by Ilari Pihlajisto. The docs will take some time to parse, but it's very powerful. xboard with an adapter is similar. [Edit: Joona wins :)]