• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling TFS 0.4 Debian 11 compiling error

Womos

Member
Joined
Dec 20, 2015
Messages
45
Reaction score
5
I'm stuck with this error when trying to compile tfs 0.4 r3884 on Debian 11
C++:
tools.cpp: In function ‘std::string transformToMD5(std::string, bool)’:
tools.cpp:43:2: error: ‘byte’ was not declared in this scope; did you mean ‘CryptoPP::byte’?
   43 |  byte digest[CryptoPP::Weak::MD5::DIGESTSIZE];
      |  ^~~~
      |  CryptoPP::byte
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/sha.h:11,
                 from tools.cpp:23:
/usr/include/cryptopp/config_int.h:56:23: note: ‘CryptoPP::byte’ declared here
   56 | typedef unsigned char byte;
      |                       ^~~~
tools.cpp:46:23: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
   46 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                       ^~~~~~
      |                       sigset
tools.cpp:46:38: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
   46 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                      ^~~~
tools.cpp:46:32: error: expected primary-expression before ‘const’
   46 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                ^~~~~
tools.cpp:46:32: error: expected ‘)’ before ‘const’
   46 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                               ~^~~~~
      |                                )
tools.cpp: In function ‘std::string transformToSHA1(std::string, bool)’:
tools.cpp:73:2: error: ‘byte’ was not declared in this scope; did you mean ‘CryptoPP::byte’?
   73 |  byte digest[CryptoPP::SHA1::DIGESTSIZE];
      |  ^~~~
      |  CryptoPP::byte
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/sha.h:11,
                 from tools.cpp:23:
/usr/include/cryptopp/config_int.h:56:23: note: ‘CryptoPP::byte’ declared here
   56 | typedef unsigned char byte;
      |                       ^~~~
tools.cpp:76:23: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
   76 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                       ^~~~~~
      |                       sigset
tools.cpp:76:38: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
   76 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                      ^~~~
tools.cpp:76:32: error: expected primary-expression before ‘const’
   76 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                ^~~~~
tools.cpp:76:32: error: expected ‘)’ before ‘const’
   76 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                               ~^~~~~
      |                                )
tools.cpp: In function ‘std::string transformToSHA256(std::string, bool)’:
tools.cpp:103:2: error: ‘byte’ was not declared in this scope; did you mean ‘CryptoPP::byte’?
  103 |  byte digest[CryptoPP::SHA256::DIGESTSIZE];
      |  ^~~~
      |  CryptoPP::byte
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/sha.h:11,
                 from tools.cpp:23:
/usr/include/cryptopp/config_int.h:56:23: note: ‘CryptoPP::byte’ declared here
   56 | typedef unsigned char byte;
      |                       ^~~~
tools.cpp:106:23: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
  106 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                       ^~~~~~
      |                       sigset
tools.cpp:106:38: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
  106 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                      ^~~~
tools.cpp:106:32: error: expected primary-expression before ‘const’
  106 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                ^~~~~
tools.cpp:106:32: error: expected ‘)’ before ‘const’
  106 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                               ~^~~~~
      |                                )
tools.cpp: In function ‘std::string transformToSHA512(std::string, bool)’:
tools.cpp:133:2: error: ‘byte’ was not declared in this scope; did you mean ‘CryptoPP::byte’?
  133 |  byte digest[CryptoPP::SHA512::DIGESTSIZE];
      |  ^~~~
      |  CryptoPP::byte
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/sha.h:11,
                 from tools.cpp:23:
/usr/include/cryptopp/config_int.h:56:23: note: ‘CryptoPP::byte’ declared here
   56 | typedef unsigned char byte;
      |                       ^~~~
tools.cpp:136:23: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
  136 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                       ^~~~~~
      |                       sigset
tools.cpp:136:38: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
  136 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                      ^~~~
tools.cpp:136:32: error: expected primary-expression before ‘const’
  136 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                                ^~~~~
tools.cpp:136:32: error: expected ‘)’ before ‘const’
  136 |  hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
      |                               ~^~~~~
      |                                )
tools.cpp: In function ‘std::string transformToVAHash(std::string, bool)’:
tools.cpp:169:2: error: ‘byte’ was not declared in this scope; did you mean ‘CryptoPP::byte’?
  169 |  byte digest[CryptoPP::SHA512::DIGESTSIZE];
      |  ^~~~
      |  CryptoPP::byte
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/sha.h:11,
                 from tools.cpp:23:
/usr/include/cryptopp/config_int.h:56:23: note: ‘CryptoPP::byte’ declared here
   56 | typedef unsigned char byte;
      |                       ^~~~
tools.cpp:172:42: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
  172 |  CryptoPP::HMAC<CryptoPP::SHA512>((const byte*)key.c_str(), key.length()).CalculateDigest(
      |                                          ^~~~
tools.cpp:172:34: error: expected primary-expression before ‘(’ token
  172 |  CryptoPP::HMAC<CryptoPP::SHA512>((const byte*)key.c_str(), key.length()).CalculateDigest(
      |                                  ^
tools.cpp:172:42: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
  172 |  CryptoPP::HMAC<CryptoPP::SHA512>((const byte*)key.c_str(), key.length()).CalculateDigest(
      |                                          ^~~~
tools.cpp:172:36: error: expected primary-expression before ‘const’
  172 |  CryptoPP::HMAC<CryptoPP::SHA512>((const byte*)key.c_str(), key.length()).CalculateDigest(
      |                                    ^~~~~
tools.cpp:172:36: error: expected ‘)’ before ‘const’
  172 |  CryptoPP::HMAC<CryptoPP::SHA512>((const byte*)key.c_str(), key.length()).CalculateDigest(
      |                                   ~^~~~~
      |                                    )
tools.cpp:183:14: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
  183 |  encoder.Put(digest, sizeof(digest));
      |              ^~~~~~
      |              sigset
tools.cpp: In function ‘uint32_t adlerChecksum(uint8_t*, size_t)’:
tools.cpp:1669:2: error: ‘byte’ was not declared in this scope; did you mean ‘CryptoPP::byte’?
 1669 |  byte digest[CryptoPP::Adler32::DIGESTSIZE];
      |  ^~~~
      |  CryptoPP::byte
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/sha.h:11,
                 from tools.cpp:23:
/usr/include/cryptopp/config_int.h:56:23: note: ‘CryptoPP::byte’ declared here
   56 | typedef unsigned char byte;
      |                       ^~~~
tools.cpp:1672:24: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
 1672 |  adler.CalculateDigest(digest, (const byte*)data, length);
      |                        ^~~~~~
      |                        sigset
tools.cpp:1672:39: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
 1672 |  adler.CalculateDigest(digest, (const byte*)data, length);
      |                                       ^~~~
tools.cpp:1672:33: error: expected primary-expression before ‘const’
 1672 |  adler.CalculateDigest(digest, (const byte*)data, length);
      |                                 ^~~~~
tools.cpp:1672:33: error: expected ‘)’ before ‘const’
 1672 |  adler.CalculateDigest(digest, (const byte*)data, length);
      |                                ~^~~~~
      |                                 )
make[1]: *** [Makefile:595: tools.o] Error 1
make[1]: *** Waiting for unfinished jobs....
mv -f .deps/tile.Tpo .deps/tile.Po
 
@Womos
It's problem with CryptoPP version 8, which is default on Ubuntu 21.10. It's easy to fix.

In tools.cpp replace:
Code:
// Use native byte instead of casting chars
byte digest[CryptoPP::SHA1::DIGESTSIZE];

// Do the actual calculation, require a byte value so we need a cast
hash.CalculateDigest(digest, (const byte*)plainText.c_str(), plainText.length());
with:
Code:
// Use native byte instead of casting chars
CryptoPP::byte digest[CryptoPP::SHA1::DIGESTSIZE];

// Do the actual calculation, require a byte value so we need a cast
hash.CalculateDigest(digest, (const CryptoPP::byte*)plainText.c_str(), plainText.length());

Full compilation instruction for Ubuntu 21.10:
1. Upload source files to /home/ots/src and replace line in tools.cpp I described above.
2. Execute:
Code:
sudo apt-get update
sudo apt-get -y install libboost-all-dev libgmp3-dev liblua5.1-0 liblua5.1-0-dev  lua5.1 libxml2-dev libxml++2.6-dev zlib1g-dev zlib1g libcrypto++-dev libcrypto++8 libssl-dev libmariadb-dev libmariadb-dev-compat cpp gcc g++ make autoconf

cd /home/ots/src
sh autogen.sh
./configure --enable-mysql --enable-server-diag
make -j 16
 
Back
Top