Stockfish-1.2 compile on Ubuntu - Error

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Stockfish-1.2 compile on Ubuntu - Error

Post by royb »

When I try to compile stockfish-1.2 on my Ubuntu 64-bit system I get this:

In file included from evaluate.h:29,
from main.cpp:31:
pawns.h: In member function ‘void PawnInfo::clear()’:
pawns.h:125: error: ‘memset’ was not declared in this scope
make: *** [main.o] Error 1

Any assistance in building a 64-bit native Linux binary for this engine is appreciated.

Roy
Pradu
Posts: 287
Joined: Sat Mar 11, 2006 3:19 am
Location: Atlanta, GA

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by Pradu »

Introduce the following line in the pawns.h file at the top of the file:

#include <string.h>

royb wrote:When I try to compile stockfish-1.2 on my Ubuntu 64-bit system I get this:

In file included from evaluate.h:29,
from main.cpp:31:
pawns.h: In member function ‘void PawnInfo::clear()’:
pawns.h:125: error: ‘memset’ was not declared in this scope
make: *** [main.o] Error 1

Any assistance in building a 64-bit native Linux binary for this engine is appreciated.

Roy
royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by royb »

That got me further, but then this error occurred:

position.cpp:316: error: ‘memcpy’ was not declared in this scope
make: *** [position.o] Error 1

Thanks for the assistance!

Roy
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by ilari »

Still the same problem, just in a different file.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by ilari »

Pradu wrote:Introduce the following line in the pawns.h file at the top of the file:

#include <string.h>
The .h extension is deprecated in modern C++. One should use #include <cstring> instead.
royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by royb »

Sorry, I don't code in C or C++ or C# -- what file is :

#include <string>

needed in now?

I tried adding it to position.h but that did not work:

position.cpp: In member function ‘void Position::from_fen(const std::string&)’:
position.cpp:129: error: ‘strchr’ was not declared in this scope
position.cpp: In member function ‘void Position::copy(const Position&)’:
position.cpp:315: error: ‘memcpy’ was not declared in this scope
make: *** [position.o] Error 1

Thanks,

Roy
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by ilari »

royb wrote:Sorry, I don't code in C or C++ or C# -- what file is :

#include <string>

needed in now?

I tried adding it to position.h but that did not work
It's <cstring>, not <string>. You should put it in position.cpp.

Obviously the developer of Stockfish should have done it, but I guess he didn't test it in Linux.
royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by royb »

ilari wrote:
royb wrote:Sorry, I don't code in C or C++ or C# -- what file is :

#include <string>

needed in now?

I tried adding it to position.h but that did not work
It's <cstring>, not <string>. You should put it in position.cpp.

Obviously the developer of Stockfish should have done it, but I guess he didn't test it in Linux.
---------------------

That got it! Thanks very much.

Roy
Pradu
Posts: 287
Joined: Sat Mar 11, 2006 3:19 am
Location: Atlanta, GA

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by Pradu »

ilari wrote:
Pradu wrote:Introduce the following line in the pawns.h file at the top of the file:

#include <string.h>
The .h extension is deprecated in modern C++. One should use #include <cstring> instead.
Indeed, but if you use cstring you must also use the std namespace qualifier or give a using directive. I proposed to just include string.h because it doesn't look like the code calls std::memset() and instead just calls memset().
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Stockfish-1.2 compile on Ubuntu - Error

Post by ilari »

Pradu wrote:
ilari wrote:
Pradu wrote:Introduce the following line in the pawns.h file at the top of the file:

#include <string.h>
The .h extension is deprecated in modern C++. One should use #include <cstring> instead.
Indeed, but if you use cstring you must also use the std namespace qualifier or give a using directive. I proposed to just include string.h because it doesn't look like the code calls std::memset() and instead just calls memset().
Actually none of the C libraries (including cstring) needs the namespace qualifier. Otherwise Roy's compile would have failed :wink: