facebookincubator/fizz

failed to compile on ubuntu18.04

hoody17 opened this issue · 2 comments

i met the error on ubuntu18.04 with gcc9.4.0: error: no matching function for call to ‘checked_add<size_t>(size_t*, size_t&, long unsigned int&, size_t&)’
here are some details
$make -j4
Scanning dependencies of target fizz
[ 1%] Building CXX object CMakeFiles/fizz.dir/crypto/Utils.cpp.o
[ 2%] Building CXX object CMakeFiles/fizz.dir/crypto/exchange/X25519.cpp.o
[ 3%] Building CXX object CMakeFiles/fizz.dir/crypto/aead/IOBufUtil.cpp.o
[ 4%] Building CXX object CMakeFiles/fizz.dir/crypto/aead/OpenSSLEVPCipher.cpp.o
[ 5%] Building CXX object CMakeFiles/fizz.dir/crypto/aead/AEGISCipher.cpp.o
[ 6%] Building CXX object CMakeFiles/fizz.dir/crypto/signature/Signature.cpp.o
[ 8%] Building CXX object CMakeFiles/fizz.dir/crypto/Hkdf.cpp.o
/home/hudi/fizz/fizz/crypto/aead/OpenSSLEVPCipher.cpp: In function ‘std::unique_ptrfolly::IOBuf fizz::{anonymous}::evpEncrypt(std::unique_ptrfolly::IOBuf&&, const folly::IOBuf*, folly::ByteRange, size_t, bool, size_t, EVP_CIPHER_CTX*, fizz::Aead::AeadOptions)’:
/home/hudi/fizz/fizz/crypto/aead/OpenSSLEVPCipher.cpp:221:36: error: no matching function for call to ‘checked_add<size_t>(size_t*, size_t&, long unsigned int&, size_t&)’
221 | if (!folly::checked_add<size_t>(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^
222 | &totalSize, headroom, inputLength, tagLen)) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/hudi/fizz/fizz/crypto/aead/OpenSSLEVPCipher.cpp:10:
/home/hudi/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/folly-2021.05.24.00-3z2pp4h5kxg45jictnzqipj4lqpog7d6/include/folly/lang/CheckedMath.h:27:6: note: candidate: ‘template<class T, class> bool folly::checked_add(T*, T, T)’
27 | bool checked_add(T* result, T a, T b) {
| ^~~~~~~~~~~
/home/hudi/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/folly-2021.05.24.00-3z2pp4h5kxg45jictnzqipj4lqpog7d6/include/folly/lang/CheckedMath.h:27:6: note: template argument deduction/substitution failed:
/home/hudi/fizz/fizz/crypto/aead/OpenSSLEVPCipher.cpp:221:36: note: candidate expects 3 arguments, 4 provided
221 | if (!folly::checked_add<size_t>(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^
222 | &totalSize, headroom, inputLength, tagLen)) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 9%] Building CXX object CMakeFiles/fizz.dir/crypto/KeyDerivation.cpp.o
CMakeFiles/fizz.dir/build.make:110: recipe for target 'CMakeFiles/fizz.dir/crypto/aead/OpenSSLEVPCipher.cpp.o' failed
make[2]: *** [CMakeFiles/fizz.dir/crypto/aead/OpenSSLEVPCipher.cpp.o] Error 1
make[2]: *** 正在等待未完成的任务....
CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/fizz.dir/all' failed
make[1]: *** [CMakeFiles/fizz.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

how can i resolve it?

How did you end up with a folly build from 2021?

/home/hudi/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/folly-2021.05.24.00-3z2pp4h5kxg45jictnzqipj4lqpog7d6/include/folly/lang/CheckedMath.h:27:6: [...]

The referenced method was added more recently. Might want to build fresh, from scratch.

Closing. Please let us know if you're still seeing problems after ^.