Files
infix/package/rousette/0026-boost-1.87-support.patch
T

83 lines
3.3 KiB
Diff

From d69697a719781ef06ecb0545a58c2d055ca53c6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
Date: Mon, 3 Mar 2025 13:32:51 +0100
Subject: [PATCH 26/44] boost 1.87 support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
In Asio 1.33 (boost 1.87) some of the deprecated functionalities were
removed [1]. For rousette there are two changes that needed to be
addressed:
* A removed include in clock.cpp. But actually, we do not need that
header at all.
* boost::asio::io_service is no longer around, it was actually renamed
to boost::asio::io_context a while ago. Its post() method is no
longer around as well, it was deprecated in favour of post()
function [2].
This function is there since boost 1.66, so let's set minimal boost
version.
A bigger problem is that our dependency nghttp2-asio seems to be a dead
project. At the time of writing this, there are no patches for more than
3 years. However, we are not the only consumers of that project and
somebody else already took care of that before us [3,4].
[1] https://www.boost.org/doc/libs/1_87_0/doc/html/boost_asio/history.html
[2] https://live.boost.org/doc/libs/1_86_0/doc/html/boost_asio/reference/io_context/post.html
[3] https://github.com/nghttp2/nghttp2-asio/issues/23
[3] https://github.com/microsoft/vcpkg/commit/8eecddf7f18792d41c58a404604eed7f87b4b462
Change-Id: Ia59bb06e5f8ed222aa6e9f1c9b3947b05afeb9ec
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
CMakeLists.txt | 4 ++--
src/clock.cpp | 1 -
src/http/EventStream.cpp | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cdd0eb4..ca41ef3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,8 +71,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
find_package(spdlog REQUIRED)
find_package(date REQUIRED) # FIXME: Remove when we have STL with __cpp_lib_chrono >= 201907 (gcc 14)
find_package(PkgConfig)
-pkg_check_modules(nghttp2 REQUIRED IMPORTED_TARGET libnghttp2_asio>=0.0.90 libnghttp2)
-find_package(Boost REQUIRED CONFIG COMPONENTS system thread)
+pkg_check_modules(nghttp2 REQUIRED IMPORTED_TARGET libnghttp2_asio>=0.0.90 libnghttp2) # To compile under boost 1.87 you have to patch nghttp2-asio using https://github.com/nghttp2/nghttp2-asio/issues/23
+find_package(Boost 1.66 REQUIRED CONFIG COMPONENTS system thread)
pkg_check_modules(SYSREPO-CPP REQUIRED IMPORTED_TARGET sysrepo-cpp>=5)
pkg_check_modules(LIBYANG-CPP REQUIRED IMPORTED_TARGET libyang-cpp>=3)
diff --git a/src/clock.cpp b/src/clock.cpp
index 16a49b2..7ac6c3e 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -5,7 +5,6 @@
*
*/
-#include <boost/asio/io_service.hpp>
#include <boost/lexical_cast.hpp>
#include <chrono>
#include <nghttp2/asio_http2_server.h>
diff --git a/src/http/EventStream.cpp b/src/http/EventStream.cpp
index 34038f4..6c765c5 100644
--- a/src/http/EventStream.cpp
+++ b/src/http/EventStream.cpp
@@ -117,6 +117,6 @@ void EventStream::enqueue(const std::string& what)
spdlog::trace("{}: new event, ∑ queue size = {}", peer, len);
queue.push_back(buf);
state = HasEvents;
- res.io_service().post([&res = this->res]() { res.resume(); });
+ boost::asio::post(res.io_service(), [&res = this->res]() { res.resume(); });
}
}
--
2.43.0