ygrek / mldonkey

cross-platform multi-network p2p daemon
http://mldonkey.sourceforge.net/
Other
235 stars 43 forks source link

Build error: /usr/lib64/ocaml/caml/compatibility.h:112:42: error: expected unqualified-id before string constant 112 | #define invalid_argument CAML_DEPRECATED("invalid_argument", "caml_invalid_argument") caml_invalid_argument #86

Closed perfect7gentleman closed 1 month ago

perfect7gentleman commented 1 year ago

Git-version. Ocaml-4.14 GCC-12.2.1

In file included from src/utils/lib/CryptoPP.cc:85:
src/utils/lib/CryptoPP.h:3940:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3940 |         BufferedTransformation::Get;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3941:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3941 |         BufferedTransformation::Peek;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3942:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3942 |         BufferedTransformation::TransferTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3943:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3943 |         BufferedTransformation::CopyTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3944:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3944 |         BufferedTransformation::CopyRangeTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3945:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3945 |         BufferedTransformation::TransferMessagesTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3946:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3946 |         BufferedTransformation::CopyMessagesTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3947:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3947 |         BufferedTransformation::TransferAllTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:3948:9: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
 3948 |         BufferedTransformation::CopyAllTo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h: In destructor ‘virtual CryptoPP::AlgorithmParametersBase::~AlgorithmParametersBase()’:
src/utils/lib/CryptoPP.h:4359:33: warning: ‘throw’ will always call ‘terminate’ [-Wterminate]
 4359 |                                 throw ParameterNotUsed(m_name);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.h:4359:33: note: in C++11 destructors default to ‘noexcept’
In file included from /usr/lib64/ocaml/caml/config.h:45,
                 from src/utils/lib/CryptoPP.h:89:
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/error_constants.h: At global scope:
/usr/lib64/ocaml/caml/compatibility.h:112:41: error: expected ‘}’ before ‘(’ token
  112 | #define invalid_argument CAML_DEPRECATED("invalid_argument", "caml_invalid_argument") caml_invalid_argument
      |                                         ^
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/system_error:39,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/ios_base.h:46,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/ios:42,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/ostream:38,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/iostream:39,
                 from src/utils/lib/CryptoPP.h:6298:
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/error_constants.h:41:5: note: to match this ‘{’
   41 |     {
      |     ^
/usr/lib64/ocaml/caml/compatibility.h:112:42: error: expected unqualified-id before string constant
  112 | #define invalid_argument CAML_DEPRECATED("invalid_argument", "caml_invalid_argument") caml_invalid_argument
      |                                          ^~~~~~~~~~~~~~~~~~
/usr/lib64/ocaml/caml/compatibility.h:112:42: error: expected ‘)’ before string constant
  112 | #define invalid_argument CAML_DEPRECATED("invalid_argument", "caml_invalid_argument") caml_invalid_argument
      |                                         ~^~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/error_constants.h:176:1: error: expected declaration before ‘}’ token
  176 | } // namespace
      | ^
/usr/lib64/ocaml/caml/compatibility.h:112:42: error: expected unqualified-id before string constant
  112 | #define invalid_argument CAML_DEPRECATED("invalid_argument", "caml_invalid_argument") caml_invalid_argument
      |                                          ^~~~~~~~~~~~~~~~~~
/usr/lib64/ocaml/caml/compatibility.h:112:42: error: expected ‘)’ before string constant
  112 | #define invalid_argument CAML_DEPRECATED("invalid_argument", "caml_invalid_argument") caml_invalid_argument
      |                                         ~^~~~~~~~~~~~~~~~~~
src/utils/lib/CryptoPP.cc: In member function ‘virtual unsigned int CryptoPP::PK_Signer::Sign(CryptoPP::RandomNumberGenerator&, CryptoPP::PK_MessageAccumulator*, CryptoPP::byte*) const’:
src/utils/lib/CryptoPP.cc:698:14: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
  698 |         std::auto_ptr<PK_MessageAccumulator> m(messageAccumulator);
      |              ^~~~~~~~
HinTak commented 1 year ago

That looks a lot related to https://github.com/ygrek/mldonkey/pull/66

perfect7gentleman commented 1 year ago

Nope, it's different one.

sl1pkn07 commented 1 year ago

removing #include <caml/config.h> from src/utils/lib/CryptoPP.h seems solve the issue (tnx @FabioLolix)

greetings

carlonluca commented 1 month ago

I recently experienced this issue as well, but removing that inclusion did not seem to fix for me. This is how I fixed it: https://github.com/carlonluca/mldonkey/commit/2e1773af9dc6a9a468811439f6863535011ee09c.

ygrek commented 1 month ago

both define CAML_NAME_SPACE and removal of caml/config.h fixes this for me. I dont' see why caml/config.h is needed there actually, so just removing the include