Strange Stockfish behavior?

Code, algorithms, languages, construction...
Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: Strange Stockfish behavior?

Post by Jeremy Bernstein » Thu Jun 30, 2011 12:42 am

Uly wrote:Thanks Jeremy, I have made a sister release thread at Rybka Forum.
Thanks Uly.

royb
Posts: 44
Joined: Thu Jun 10, 2010 1:09 am

Re: Strange Stockfish behavior?

Post by royb » Thu Jun 30, 2011 3:12 am

When I try to compile the source on Ubuntu 11.04 I get this error:

roy@ubuntu-vm1:~/chess/SF-2.1.1-PA-GTB$ make profile-build ARCH=x86-64
Makefile:1: *** missing separator. Stop.
roy@ubuntu-vm1:~/chess/SF-2.1.1-PA-GTB$

Any suggestions as to what is not quite right?

I downloaded the .7z file and extracted it into its own directory and tried to compile it. The "normal" Stockfish-2.1.1 compiles fine on this system, if that helps point towards anything in particular.

Thanks,

Roy

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: Strange Stockfish behavior?

Post by BB+ » Thu Jun 30, 2011 6:02 am

Code: Select all

00000000   EF BB BF 23  20 53 74 6F  63 6B 66 69  73 68 2C 20  ...# Stockfish,
There are three "extra" bytes (EF BB BF) prior to the # Stockfish on the first line of the (primary) Makefile. They have something to do with "byte order" and/or identifying UTF-8: http://en.wikipedia.org/wiki/Byte_order_mark

royb
Posts: 44
Joined: Thu Jun 10, 2010 1:09 am

Re: Strange Stockfish behavior?

Post by royb » Thu Jun 30, 2011 6:15 am

So how do I get rid of those extra bytes? When I delete the first character of the file in vim, it deletes the # in '# Stockfish' ...

I tried deleting that and re-adding the # and recompiling -- same error as before.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: Strange Stockfish behavior?

Post by BB+ » Thu Jun 30, 2011 6:21 am

Yeah, I agree it's not easy to handle these strange byte codes with various text editors. Maybe put a newline after the #, then delete all the stuff above it, and re-type the first #. Or just delete the first line -- if you want, you could re-type it, and/or copy/paste this one in its place:

Code: Select all

# Stockfish, a UCI chess playing engine derived from Glaurung 2.1
You could also use hexedit and change the first three bytes to 23 23 23 (all # characters).

If you don't build with USE_EGTB, then

Code: Select all

search.cpp:433: error: 'UseGaviotaTb' was not declared in this scope
search.cpp:434: error: 'ProbeOnlyAtRoot' was not declared in this scope

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: Strange Stockfish behavior?

Post by Jeremy Bernstein » Thu Jun 30, 2011 7:15 am

BB+ wrote:

Code: Select all

00000000   EF BB BF 23  20 53 74 6F  63 6B 66 69  73 68 2C 20  ...# Stockfish,
There are three "extra" bytes (EF BB BF) prior to the # Stockfish on the first line of the (primary) Makefile. They have something to do with "byte order" and/or identifying UTF-8: http://en.wikipedia.org/wiki/Byte_order_mark
This makefile error is usually the result of spaces in the makefile. Indented lines in makefiles need to start with tab characters. Sorry about that. I haven't actually tried using the makefile since updating the codebase to SF 2.1.1, although I made a couple of changes to it to reflect new and missing files, so I'm sure I introduced this problem. Please let me know if that fixes it, and I'll make that change for the next release.

EDIT: sorry, Mark was right -- one of the issues is the BOM. I've removed it and will get the makefile working properly for BSD.

Jeremy

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: Strange Stockfish behavior?

Post by Jeremy Bernstein » Thu Jun 30, 2011 7:34 am

BB+ wrote:If you don't build with USE_EGTB, then

Code: Select all

search.cpp:433: error: 'UseGaviotaTb' was not declared in this scope
search.cpp:434: error: 'ProbeOnlyAtRoot' was not declared in this scope
Oops. I'll fix that, too. Thanks

EDIT: fixed in the source repository.

Jeremy

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: Strange Stockfish behavior?

Post by Jeremy Bernstein » Thu Jun 30, 2011 8:11 am

Attached is a fixed Makefile. If you want to build with the EGTBs (on by default, otherwise set line 66 in the Makefile to 'no'), you should first build libgtb.a in the egtb directory (the Makefile there is the default for unix -- I have a modified one which works on OSX if you need it) and then run 'make [ARCH]' for stockfish. Works for me here. Sorry again for the inconvenience.

EDIT: fixed makefile is here: viewtopic.php?f=5&t=1234&p=12770#p12770

royb
Posts: 44
Joined: Thu Jun 10, 2010 1:09 am

Re: Strange Stockfish behavior?

Post by royb » Thu Jun 30, 2011 1:49 pm

Things are almost there now with the fixed Makefile. However there is an issue with EGTB. I added 'USE EGTB' to my command line for the make command and I get errors about egtb/gtb-probe.h no found. I created symlinks in egtb directory to ../gtb-probe.h (and a couple others if memory serves). However now I get this error:

... <snip> ...
g++ -o stockfish bitboard.o pawns.o material.o endgame.o egtb.o evaluate.o main.o misc.o move.o movegen.o movepick.o search.o position.o tt.o uci.o ucioption.o book.o bitbase.o thread.o benchmark.o timeman.o -L. -lpthread -static-libstdc++ -static-libgcc -lgcov -lgtb
/usr/bin/ld: cannot find -lgtb
collect2: ld returned 1 exit status
make[2]: *** [stockfish] Error 1
make[2]: Leaving directory `/home/roy/chess/SF-2.1.1-PA-GTB'
make[1]: *** [gcc-profile-make] Error 2
make[1]: Leaving directory `/home/roy/chess/SF-2.1.1-PA-GTB'
make: *** [profile-build] Error 2
roy@ubuntu-vm1:~/chess/SF-2.1.1-PA-GTB$

The unhappiness starts with: /usr/bin/ld: cannot find -lgtb

I'm not a Makefile guy and not a git person so pulling the source from the git repository is not something I'm knowledgeable about.

Thanks.

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: Strange Stockfish behavior?

Post by Jeremy Bernstein » Thu Jun 30, 2011 2:04 pm

royb wrote:Things are almost there now with the fixed Makefile. However there is an issue with EGTB. I added 'USE EGTB' to my command line for the make command and I get errors about egtb/gtb-probe.h no found. I created symlinks in egtb directory to ../gtb-probe.h (and a couple others if memory serves). However now I get this error:

... <snip> ...
g++ -o stockfish bitboard.o pawns.o material.o endgame.o egtb.o evaluate.o main.o misc.o move.o movegen.o movepick.o search.o position.o tt.o uci.o ucioption.o book.o bitbase.o thread.o benchmark.o timeman.o -L. -lpthread -static-libstdc++ -static-libgcc -lgcov -lgtb
/usr/bin/ld: cannot find -lgtb
collect2: ld returned 1 exit status
make[2]: *** [stockfish] Error 1
make[2]: Leaving directory `/home/roy/chess/SF-2.1.1-PA-GTB'
make[1]: *** [gcc-profile-make] Error 2
make[1]: Leaving directory `/home/roy/chess/SF-2.1.1-PA-GTB'
make: *** [profile-build] Error 2
roy@ubuntu-vm1:~/chess/SF-2.1.1-PA-GTB$

The unhappiness starts with: /usr/bin/ld: cannot find -lgtb

I'm not a Makefile guy and not a git person so pulling the source from the git repository is not something I'm knowledgeable about.

Thanks.
1. cd src/egtb
2. make (this will build the libgtb.a file that you need)
3. cd ..
4. make [ARCH]

that should be all you need to do. You don't need to add USE_EGTB to the command line, but you do have to build the static library libgtb first, and then just run the stockfish makefile. It Should Just Work©.

Jeremy

Post Reply