Nheko-Reborn / mtxclient

Client API library for Matrix, built on top of libcurl
MIT License
40 stars 25 forks source link

GCC 13 build failure #90

Closed xvitaly closed 1 year ago

xvitaly commented 1 year ago

Build failure under GCC 13:

[1/76] /usr/bin/g++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dmatrix_client_EXPORTS -I/builddir/build/BUILD/mtxclient-0.9.1/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer        -Wall       -Wextra         -Wconversion        -pipe       -pedantic       -fsized-deallocation        -fdiagnostics-color=always      -Wno-attributes         -Wunreachable-code -DNDEBUG -fPIC -pthread -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -std=c++20 -MD -MT CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o -MF CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o.d -o CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o -c /builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp
FAILED: CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o 
/usr/bin/g++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dmatrix_client_EXPORTS -I/builddir/build/BUILD/mtxclient-0.9.1/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer       -Wall       -Wextra         -Wconversion        -pipe       -pedantic       -fsized-deallocation        -fdiagnostics-color=always      -Wno-attributes         -Wunreachable-code -DNDEBUG -fPIC -pthread -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -std=c++20 -MD -MT CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o -MF CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o.d -o CMakeFiles/matrix_client.dir/lib/crypto/encoding.cpp.o -c /builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:33:22: error: 'uint8_t' was not declared in this scope
   33 | constexpr std::array<uint8_t, 256>
      |                      ^~~~~~~
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:6:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    5 | #include <vector>
  +++ |+#include <cstdint>
    6 | 
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:33:34: error: template argument 1 is invalid
   33 | constexpr std::array<uint8_t, 256>
      |                                  ^
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:33:16: error: '<expression error>' in namespace 'std' does not name a type
   33 | constexpr std::array<uint8_t, 256>
      |                ^~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:48:59: error: 'invert_alphabet' was not declared in this scope; did you mean 'base64_alphabet'?
   48 | static constexpr const std::array base64_to_int         = invert_alphabet(base64_alphabet);
      |                                                           ^~~~~~~~~~~~~~~
      |                                                           base64_alphabet
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:49:59: error: 'invert_alphabet' was not declared in this scope; did you mean 'base64_alphabet'?
   49 | static constexpr const std::array base64_urlsafe_to_int = invert_alphabet(base64_urlsafe_alphabet);
      |                                                           ^~~~~~~~~~~~~~~
      |                                                           base64_alphabet
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:50:59: error: 'invert_alphabet' was not declared in this scope; did you mean 'base64_alphabet'?
   50 | static constexpr const std::array base58_to_int         = invert_alphabet(base58_alphabet);
      |                                                           ^~~~~~~~~~~~~~~
      |                                                           base64_alphabet
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp: In function 'std::string {anonymous}::encode_base58(const std::array<char, 58>&, const std::string&)':
/builddir/build/BUILD/mtxclient-0.9.1/lib/crypto/encoding.cpp:64:17: error: 'uint8_t' was not declared in this scope

Fix:

#include <vector>
+#include <cstdint>