From f6eaa0c3bc35c774eb0edc0ce41fefa7fa631f32 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Thu, 13 Jul 2023 13:25:08 -0400 Subject: [PATCH] Update dependencies (#4595) Use the most recent versions in ConanCenter. * Due to a bug in Clang 16, you may get a compile error: "call to 'async_teardown' is ambiguous" * A compiler flag workaround is documented in `BUILD.md`. * At this time, building this with gcc 13 may require editing some files in `.conan/data` * A patch to support gcc13 may be added in a later PR. --------- Co-authored-by: Scott Schurr --- .github/actions/dependencies/action.yml | 5 +++- .github/workflows/macos.yml | 4 ++++ BUILD.md | 20 +++++++++++++--- conanfile.py | 23 +++++++++--------- external/snappy/conandata.yml | 24 +++++++++++++++++++ .../1.1.10-0001-fix-inlining-failure.patch | 13 ++++++++++ ....10-0003-fix-clobber-list-older-llvm.patch | 13 ++++++++++ src/ripple/basics/RangeSet.h | 1 + src/ripple/consensus/Consensus.h | 3 +++ src/ripple/net/HTTPClient.h | 4 ++++ src/ripple/overlay/impl/Handshake.cpp | 24 ++++++++++--------- src/ripple/overlay/impl/PeerImp.cpp | 14 +++++------ src/ripple/rpc/impl/ServerHandler.cpp | 4 ++-- src/ripple/rpc/impl/WSInfoSub.h | 2 +- src/test/app/LedgerLoad_test.cpp | 2 +- src/test/jtx/TrustedPublisherServer.h | 4 ++-- 16 files changed, 121 insertions(+), 39 deletions(-) create mode 100644 external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch create mode 100644 external/snappy/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch diff --git a/.github/actions/dependencies/action.yml b/.github/actions/dependencies/action.yml index af570f21b82..3147e8774f2 100644 --- a/.github/actions/dependencies/action.yml +++ b/.github/actions/dependencies/action.yml @@ -6,10 +6,13 @@ inputs: runs: using: composite steps: + - name: unlock Conan + shell: bash + run: conan remove --locks - name: export custom recipes shell: bash run: | - conan export external/snappy snappy/1.1.9@ + conan export external/snappy snappy/1.1.10@ conan export external/soci soci/4.0.3@ - name: install dependencies shell: bash diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 888ad6f7692..1ebb9f690bb 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -33,6 +33,10 @@ jobs: conan --version cmake --version env | sort + - name: configure Conan + run : | + conan profile get env.CXXFLAGS default || true + conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default - name: build uses: ./.github/actions/build with: diff --git a/BUILD.md b/BUILD.md index 4ef5e5aad2c..daef082fdd1 100644 --- a/BUILD.md +++ b/BUILD.md @@ -117,7 +117,7 @@ can't build earlier Boost versions. which allows you to statically link it with GCC, if you want. ``` - conan export external/snappy snappy/1.1.9@ + conan export external/snappy snappy/1.1.10@ ``` 5. Export our [Conan recipe for SOCI](./external/soci). @@ -180,7 +180,7 @@ can't build earlier Boost versions. `$OUTPUT_FOLDER/build/generators/conan_toolchain.cmake`. Single-config generators: - + ``` cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release .. ``` @@ -210,7 +210,7 @@ can't build earlier Boost versions. ``` Multi-config generators: - + ``` cmake --build . --config Release cmake --build . --config Debug @@ -279,6 +279,18 @@ conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_R ``` +### call to 'async_teardown' is ambiguous + +If you are compiling with an early version of Clang 16, then you might hit +a [regression][6] when compiling C++20 that manifests as an [error in a Boost +header][7]. You can workaround it by adding this preprocessor definition: + +``` +conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_DISABLE_CONCEPTS"' default +conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default +``` + + ### recompile with -fPIC If you get a linker error suggesting that you recompile Boost with @@ -319,6 +331,8 @@ If you want to experiment with a new package, follow these steps: [2]: https://en.cppreference.com/w/cpp/compiler_support/20 [3]: https://docs.conan.io/en/latest/getting_started.html [5]: https://en.wikipedia.org/wiki/Unity_build +[6]: https://github.com/boostorg/beast/issues/2648 +[7]: https://github.com/boostorg/beast/issues/2661 [build_type]: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html [runtime]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html [toolchain]: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html diff --git a/conanfile.py b/conanfile.py index 9c135d9e445..25d30d23c37 100644 --- a/conanfile.py +++ b/conanfile.py @@ -24,18 +24,18 @@ class Xrpl(ConanFile): } requires = [ - 'boost/1.77.0', + 'boost/1.82.0', 'date/3.0.1', - 'libarchive/3.6.0', - 'lz4/1.9.3', 'grpc/1.50.1', + 'libarchive/3.6.2', + 'lz4/1.9.3', 'nudb/2.0.8', - 'openssl/1.1.1m', - 'protobuf/3.21.4', - 'snappy/1.1.9', + 'openssl/1.1.1u', + 'protobuf/3.21.9', + 'snappy/1.1.10', 'soci/4.0.3', - 'sqlite3/3.38.0', - 'zlib/1.2.12', + 'sqlite3/3.42.0', + 'zlib/1.2.13', ] default_options = { @@ -51,6 +51,7 @@ class Xrpl(ConanFile): 'unity': False, 'cassandra-cpp-driver:shared': False, + 'cassandra-cpp-driver:use_atomic': None, 'date:header_only': True, 'grpc:shared': False, 'grpc:secure': True, @@ -101,12 +102,12 @@ def configure(self): def requirements(self): if self.options.jemalloc: - self.requires('jemalloc/5.2.1') + self.requires('jemalloc/5.3.0') if self.options.reporting: self.requires('cassandra-cpp-driver/2.15.3') - self.requires('libpq/13.6') + self.requires('libpq/14.7') if self.options.rocksdb: - self.requires('rocksdb/6.27.3') + self.requires('rocksdb/6.29.5') exports_sources = ( 'CMakeLists.txt', 'Builds/*', 'bin/getRippledInfo', 'src/*', 'cfg/*' diff --git a/external/snappy/conandata.yml b/external/snappy/conandata.yml index 6c12aed54a1..1488c7a2baf 100644 --- a/external/snappy/conandata.yml +++ b/external/snappy/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.10": + url: "https://github.com/google/snappy/archive/1.1.10.tar.gz" + sha256: "49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90" "1.1.9": url: "https://github.com/google/snappy/archive/1.1.9.tar.gz" sha256: "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7" @@ -9,8 +12,29 @@ sources: url: "https://github.com/google/snappy/archive/1.1.7.tar.gz" sha256: "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4" patches: + "1.1.10": + - patch_file: "patches/1.1.10-0001-fix-inlining-failure.patch" + patch_description: "disable inlining for compilation error" + patch_type: "portability" + - patch_file: "patches/1.1.9-0002-no-Werror.patch" + patch_description: "disable 'warning as error' options" + patch_type: "portability" + - patch_file: "patches/1.1.10-0003-fix-clobber-list-older-llvm.patch" + patch_description: "disable inline asm on apple-clang" + patch_type: "portability" + - patch_file: "patches/1.1.9-0004-rtti-by-default.patch" + patch_description: "remove 'disable rtti'" + patch_type: "conan" "1.1.9": - patch_file: "patches/1.1.9-0001-fix-inlining-failure.patch" + patch_description: "disable inlining for compilation error" + patch_type: "portability" - patch_file: "patches/1.1.9-0002-no-Werror.patch" + patch_description: "disable 'warning as error' options" + patch_type: "portability" - patch_file: "patches/1.1.9-0003-fix-clobber-list-older-llvm.patch" + patch_description: "disable inline asm on apple-clang" + patch_type: "portability" - patch_file: "patches/1.1.9-0004-rtti-by-default.patch" + patch_description: "remove 'disable rtti'" + patch_type: "conan" diff --git a/external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch b/external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch new file mode 100644 index 00000000000..66b0f055219 --- /dev/null +++ b/external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch @@ -0,0 +1,13 @@ +diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h +index 1548ed7..3b4a9f3 100644 +--- a/snappy-stubs-internal.h ++++ b/snappy-stubs-internal.h +@@ -100,7 +100,7 @@ + + // Inlining hints. + #if HAVE_ATTRIBUTE_ALWAYS_INLINE +-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) ++#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE + #else + #define SNAPPY_ATTRIBUTE_ALWAYS_INLINE + #endif // HAVE_ATTRIBUTE_ALWAYS_INLINE diff --git a/external/snappy/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch b/external/snappy/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch new file mode 100644 index 00000000000..969ce3805da --- /dev/null +++ b/external/snappy/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch @@ -0,0 +1,13 @@ +diff --git a/snappy.cc b/snappy.cc +index d414718..e4efb59 100644 +--- a/snappy.cc ++++ b/snappy.cc +@@ -1132,7 +1132,7 @@ inline size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) { + size_t literal_len = *tag >> 2; + size_t tag_type = *tag; + bool is_literal; +-#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) ++#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) ) + // TODO clang misses the fact that the (c & 3) already correctly + // sets the zero flag. + asm("and $3, %k[tag_type]\n\t" diff --git a/src/ripple/basics/RangeSet.h b/src/ripple/basics/RangeSet.h index e003a229af0..3a9e470ddfb 100644 --- a/src/ripple/basics/RangeSet.h +++ b/src/ripple/basics/RangeSet.h @@ -28,6 +28,7 @@ #include #include +#include namespace ripple { diff --git a/src/ripple/consensus/Consensus.h b/src/ripple/consensus/Consensus.h index 71ceed71431..ea88e3232ee 100644 --- a/src/ripple/consensus/Consensus.h +++ b/src/ripple/consensus/Consensus.h @@ -30,6 +30,9 @@ #include #include #include + +#include +#include #include #include diff --git a/src/ripple/net/HTTPClient.h b/src/ripple/net/HTTPClient.h index 8cadc84bcb2..f133e3ee04a 100644 --- a/src/ripple/net/HTTPClient.h +++ b/src/ripple/net/HTTPClient.h @@ -24,7 +24,11 @@ #include #include #include + #include +#include +#include +#include namespace ripple { diff --git a/src/ripple/overlay/impl/Handshake.cpp b/src/ripple/overlay/impl/Handshake.cpp index 9fe025787f8..8fe383e1d47 100644 --- a/src/ripple/overlay/impl/Handshake.cpp +++ b/src/ripple/overlay/impl/Handshake.cpp @@ -25,7 +25,9 @@ #include #include #include + #include + #include #include @@ -44,7 +46,7 @@ getFeatureValue( return {}; boost::smatch match; boost::regex rx(feature + "=([^;\\s]+)"); - auto const value = header->value().to_string(); + std::string const value = header->value(); if (boost::regex_search(value, match, rx)) return {match[1]}; return {}; @@ -233,7 +235,7 @@ verifyHandshake( { if (auto const iter = headers.find("Server-Domain"); iter != headers.end()) { - if (!isProperlyFormedTomlDomain(iter->value().to_string())) + if (!isProperlyFormedTomlDomain(iter->value())) throw std::runtime_error("Invalid server domain"); } @@ -241,7 +243,7 @@ verifyHandshake( { std::uint32_t nid; - if (!beast::lexicalCastChecked(nid, iter->value().to_string())) + if (!beast::lexicalCastChecked(nid, std::string(iter->value()))) throw std::runtime_error("Invalid peer network identifier"); if (networkID && nid != *networkID) @@ -251,7 +253,7 @@ verifyHandshake( if (auto const iter = headers.find("Network-Time"); iter != headers.end()) { auto const netTime = - [str = iter->value().to_string()]() -> TimeKeeper::time_point { + [str = std::string(iter->value())]() -> TimeKeeper::time_point { TimeKeeper::duration::rep val; if (beast::lexicalCastChecked(val, str)) @@ -286,8 +288,8 @@ verifyHandshake( PublicKey const publicKey = [&headers] { if (auto const iter = headers.find("Public-Key"); iter != headers.end()) { - auto pk = parseBase58( - TokenType::NodePublic, iter->value().to_string()); + auto pk = + parseBase58(TokenType::NodePublic, iter->value()); if (pk) { @@ -313,7 +315,7 @@ verifyHandshake( if (iter == headers.end()) throw std::runtime_error("No session signature specified"); - auto sig = base64_decode(iter->value().to_string()); + auto sig = base64_decode(iter->value()); if (!verifyDigest(publicKey, sharedValue, makeSlice(sig), false)) throw std::runtime_error("Failed to verify session"); @@ -325,8 +327,8 @@ verifyHandshake( if (auto const iter = headers.find("Local-IP"); iter != headers.end()) { boost::system::error_code ec; - auto const local_ip = boost::asio::ip::address::from_string( - iter->value().to_string(), ec); + auto const local_ip = + boost::asio::ip::address::from_string(iter->value(), ec); if (ec) throw std::runtime_error("Invalid Local-IP"); @@ -340,8 +342,8 @@ verifyHandshake( if (auto const iter = headers.find("Remote-IP"); iter != headers.end()) { boost::system::error_code ec; - auto const remote_ip = boost::asio::ip::address::from_string( - iter->value().to_string(), ec); + auto const remote_ip = + boost::asio::ip::address::from_string(iter->value(), ec); if (ec) throw std::runtime_error("Invalid Remote-IP"); diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index a07c457458c..0d58a10abac 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -176,7 +176,7 @@ PeerImp::run() if (auto const iter = headers_.find("Closed-Ledger"); iter != headers_.end()) { - closed = parseLedgerHash(iter->value().to_string()); + closed = parseLedgerHash(iter->value()); if (!closed) fail("Malformed handshake data (1)"); @@ -185,7 +185,7 @@ PeerImp::run() if (auto const iter = headers_.find("Previous-Ledger"); iter != headers_.end()) { - previous = parseLedgerHash(iter->value().to_string()); + previous = parseLedgerHash(iter->value()); if (!previous) fail("Malformed handshake data (2)"); @@ -372,8 +372,8 @@ std::string PeerImp::getVersion() const { if (inbound_) - return headers_["User-Agent"].to_string(); - return headers_["Server"].to_string(); + return headers_["User-Agent"]; + return headers_["Server"]; } Json::Value @@ -399,8 +399,8 @@ PeerImp::json() if (auto const d = domain(); !d.empty()) ret[jss::server_domain] = domain(); - if (auto const nid = headers_["Network-ID"].to_string(); !nid.empty()) - ret[jss::network_id] = nid; + if (auto const nid = headers_["Network-ID"]; !nid.empty()) + ret[jss::network_id] = std::string(nid); ret[jss::load] = usage_.balance(); @@ -839,7 +839,7 @@ PeerImp::name() const std::string PeerImp::domain() const { - return headers_["Server-Domain"].to_string(); + return headers_["Server-Domain"]; } //------------------------------------------------------------------------------ diff --git a/src/ripple/rpc/impl/ServerHandler.cpp b/src/ripple/rpc/impl/ServerHandler.cpp index 85bff54232b..f33ecd625aa 100644 --- a/src/ripple/rpc/impl/ServerHandler.cpp +++ b/src/ripple/rpc/impl/ServerHandler.cpp @@ -248,11 +248,11 @@ build_map(boost::beast::http::fields const& h) std::map c; for (auto const& e : h) { - auto key(e.name_string().to_string()); + std::string key(e.name_string()); std::transform(key.begin(), key.end(), key.begin(), [](auto kc) { return std::tolower(static_cast(kc)); }); - c[key] = e.value().to_string(); + c[key] = e.value(); } return c; } diff --git a/src/ripple/rpc/impl/WSInfoSub.h b/src/ripple/rpc/impl/WSInfoSub.h index 8f386c8ebf9..267c8f98f24 100644 --- a/src/ripple/rpc/impl/WSInfoSub.h +++ b/src/ripple/rpc/impl/WSInfoSub.h @@ -50,7 +50,7 @@ class WSInfoSub : public InfoSub { auto it = h.find("X-User"); if (it != h.end()) - user_ = it->value().to_string(); + user_ = it->value(); fwdfor_ = std::string(forwardedFor(h)); } } diff --git a/src/test/app/LedgerLoad_test.cpp b/src/test/app/LedgerLoad_test.cpp index 2685014e474..93fc002ae2a 100644 --- a/src/test/app/LedgerLoad_test.cpp +++ b/src/test/app/LedgerLoad_test.cpp @@ -154,7 +154,7 @@ class LedgerLoad_test : public beast::unit_test::suite copy_file( sd.ledgerFile, ledgerFileCorrupt, - copy_option::overwrite_if_exists, + copy_options::overwrite_existing, ec); if (!BEAST_EXPECTS(!ec, ec.message())) return; diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 985c1bfd6c0..da7ea1c137a 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -574,7 +574,7 @@ xbEQ+TUZ5jbJGSeBqNFKFeuOUQGJ46Io0jBSYd4rSmKUXkvElQwR+n7KF3jy1uAt if (ec) break; - auto path = req.target().to_string(); + std::string path = req.target(); res.insert("Server", "TrustedPublisherServer"); res.version(req.version()); res.keep_alive(req.keep_alive()); @@ -642,7 +642,7 @@ xbEQ+TUZ5jbJGSeBqNFKFeuOUQGJ46Io0jBSYd4rSmKUXkvElQwR+n7KF3jy1uAt auto const sleep_sec = boost::lexical_cast(path.substr(7)); std::this_thread::sleep_for( - std::chrono::seconds{sleep_sec}); + std::chrono::seconds(sleep_sec)); } else if (boost::starts_with(path, "/redirect")) {