Skip to content

Commit

Permalink
Update dependencies (XRPLF#4595)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
2 people authored and ckeshava committed Sep 22, 2023
1 parent ecd1ed0 commit 327c0c9
Show file tree
Hide file tree
Showing 16 changed files with 121 additions and 39 deletions.
5 changes: 4 additions & 1 deletion .github/actions/dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 17 additions & 3 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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 ..
```
Expand Down Expand Up @@ -210,7 +210,7 @@ can't build earlier Boost versions.
```
Multi-config generators:
```
cmake --build . --config Release
cmake --build . --config Debug
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 12 additions & 11 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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,
Expand Down Expand Up @@ -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/*'
Expand Down
24 changes: 24 additions & 0 deletions external/snappy/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
13 changes: 13 additions & 0 deletions external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions src/ripple/basics/RangeSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <optional>
#include <string>
#include <vector>

namespace ripple {

Expand Down
3 changes: 3 additions & 0 deletions src/ripple/consensus/Consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include <ripple/consensus/LedgerTiming.h>
#include <ripple/json/json_writer.h>
#include <boost/logic/tribool.hpp>

#include <chrono>
#include <deque>
#include <optional>
#include <sstream>

Expand Down
4 changes: 4 additions & 0 deletions src/ripple/net/HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
#include <ripple/core/Config.h>
#include <boost/asio/io_service.hpp>
#include <boost/asio/streambuf.hpp>

#include <chrono>
#include <deque>
#include <functional>
#include <string>

namespace ripple {

Expand Down
24 changes: 13 additions & 11 deletions src/ripple/overlay/impl/Handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <ripple/beast/rfc2616.h>
#include <ripple/overlay/impl/Handshake.h>
#include <ripple/protocol/digest.h>

#include <boost/regex.hpp>

#include <algorithm>
#include <chrono>

Expand All @@ -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 {};
Expand Down Expand Up @@ -233,15 +235,15 @@ 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");
}

if (auto const iter = headers.find("Network-ID"); iter != headers.end())
{
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)
Expand All @@ -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))
Expand Down Expand Up @@ -286,8 +288,8 @@ verifyHandshake(
PublicKey const publicKey = [&headers] {
if (auto const iter = headers.find("Public-Key"); iter != headers.end())
{
auto pk = parseBase58<PublicKey>(
TokenType::NodePublic, iter->value().to_string());
auto pk =
parseBase58<PublicKey>(TokenType::NodePublic, iter->value());

if (pk)
{
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand Down
14 changes: 7 additions & 7 deletions src/ripple/overlay/impl/PeerImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand All @@ -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)");
Expand Down Expand Up @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -839,7 +839,7 @@ PeerImp::name() const
std::string
PeerImp::domain() const
{
return headers_["Server-Domain"].to_string();
return headers_["Server-Domain"];
}

//------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/rpc/impl/ServerHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ build_map(boost::beast::http::fields const& h)
std::map<std::string, std::string> 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<unsigned char>(kc));
});
c[key] = e.value().to_string();
c[key] = e.value();
}
return c;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/rpc/impl/WSInfoSub.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/app/LedgerLoad_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 327c0c9

Please sign in to comment.