Problem with Stockfish make signature-profile-build

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Problem with Stockfish make signature-profile-build

Post by zullil »

Code: Select all

Running benchmark for getting the signature ...
sed: -e: No such file or directory
make: *** [embed-signature] Error 1
This much works:

Code: Select all

LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] more sign.txt
4769737
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Problem with Stockfish make signature-profile-build

Post by mcostalba »

zullil wrote:

Code: Select all

Running benchmark for getting the signature ...
sed: -e: No such file or directory
make: *** [embed-signature] Error 1
This much works:

Code: Select all

LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] more sign.txt
4769737
it seems 'sed' is not installed on your ssetup
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

mcostalba wrote:
zullil wrote:

Code: Select all

Running benchmark for getting the signature ...
sed: -e: No such file or directory
make: *** [embed-signature] Error 1
This much works:

Code: Select all

LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] more sign.txt
4769737
it seems 'sed' is not installed on your ssetup
Hi Marco,

sed is certainly available:

Code: Select all

LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] which sed
/usr/bin/sed
LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] more sign.txt 
4769737
LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] sed -i -e 's,^,/static const string Version/s/"\\(.*\\)"/"sig-,1' -e 's,$$,"/1,1' sign.txt
sed: -e: No such file or directory
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

This works for me:

Code: Select all

embed-signature:
        @echo "Running benchmark for getting the signature ..."
        @$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\1/p' > sign.txt
        @sed -i '' -e 's,^,/static const string Version/s/"\\(.*\\)"/"sig-,1' -e 's,$$,"/1,1' sign.txt
        @sed -i '' -f sign.txt misc.cpp
        @rm sign.txt

Code: Select all

LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] ./stockfish  
Stockfish sig-4769737 64 SSE4.2 by Tord Romstad, Marco Costalba and Joona Kiiski
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Problem with Stockfish make signature-profile-build

Post by mcostalba »

zullil wrote:This works for me:
Unfortunately not for me.

Could you please test the following ?

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\1/p' > sign.txt
	@sed -e 's,^,/static const string Version/s/"\\(.*\\)"/"sig-,1' -e 's,$$,"/1,1' -i sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

mcostalba wrote:
zullil wrote:This works for me:
Unfortunately not for me.

Could you please test the following ?

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\1/p' > sign.txt
	@sed -e 's,^,/static const string Version/s/"\\(.*\\)"/"sig-,1' -e 's,$$,"/1,1' -i sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

Already tried that, and it didn't work. But I'll try again to be sure.

No good here:

Code: Select all

Running benchmark for getting the signature ...
sed: -i may not be used with stdin
make: *** [embed-signature] Error 1
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

How about this?

Code: Select all

embed-signature: 
        @echo "Running benchmark for getting the signature ..." 
        @$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\1/p' > sign.txt 
        @sed -i .bak -e 's,^,/static const string Version/s/"\\(.*\\)"/"sig-,1' -e 's,$$,"/1,1' sign.txt 
        @sed -i .bak -f sign.txt misc.cpp 
        @rm sign.txt *.bak 
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problem with Stockfish make signature-profile-build

Post by Sven »

zullil wrote:How about this?

Code: Select all

embed-signature: 
        @echo "Running benchmark for getting the signature ..." 
        @$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\1/p' > sign.txt 
        @sed -i .bak -e 's,^,/static const string Version/s/"\\(.*\\)"/"sig-,1' -e 's,$$,"/1,1' sign.txt 
        @sed -i .bak -f sign.txt misc.cpp 
        @rm sign.txt *.bak 
I found this link which explains the problem, i.e. "sed -i" behaves differently on Mac OS X than on Linux.

@Marco: maybe on Makefile level the "-i" option could be replaced by a variable like SED_INPLACE_OPTION expanding to "-i" on Linux and other platforms where this works, but to "-i .bak" on Mac OS X. Or something similar. It would in fact be a configure issue.

Sven
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Problem with Stockfish make signature-profile-build

Post by mcostalba »

Ok, I have modified sed command to write the file in one go, this should work although is ugly as hell :-)

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

Could you please verify ?
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

mcostalba wrote:Ok, I have modified sed command to write the file in one go, this should work although is ugly as hell :-)

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

Could you please verify ?
Fails here, as before:

Code: Select all

Running benchmark for getting the signature ...
sed: -i may not be used with stdin
make: *** [embed-signature] Error 1