From 5f584323c2899912527eb226de0dcf6f8a884a7e Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 14 Mar 2020 16:49:38 +0100 Subject: [PATCH] Monkey patch async pipes foor Boost 1.72 This is an simple workaround and it's much more practical than having to downgrade Boost since that breaks any application that links to it. --- meson.build | 4 +--- src/plugin/host-bridge.cpp | 2 +- src/plugin/host-bridge.h | 23 ++++++++++++++++++++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 244837a0..864f5516 100644 --- a/meson.build +++ b/meson.build @@ -20,9 +20,7 @@ endif # about the way these two components work together can be found in the readme # file. -# Boost 1.72 has a known bug in Boost.Process that will cause compilation to -# fail, see https://github.com/boostorg/process/issues/116 -boost_dep = dependency('boost', version : '!=1.72', modules : ['filesystem']) +boost_dep = dependency('boost', modules : ['filesystem']) bitsery_dep = subproject('bitsery').get_variable('bitsery_dep') threads_dep = dependency('threads') # The built in threads dependency does not know how to handle winegcc diff --git a/src/plugin/host-bridge.cpp b/src/plugin/host-bridge.cpp index 2b2815ff..3b8c573f 100644 --- a/src/plugin/host-bridge.cpp +++ b/src/plugin/host-bridge.cpp @@ -326,7 +326,7 @@ void HostBridge::set_parameter(AEffect* /*plugin*/, int index, float value) { assert(!response.value.has_value()); } -void HostBridge::async_log_pipe_lines(bp::async_pipe& pipe, +void HostBridge::async_log_pipe_lines(patched_async_pipe& pipe, boost::asio::streambuf& buffer, std::string prefix) { boost::asio::async_read_until( diff --git a/src/plugin/host-bridge.h b/src/plugin/host-bridge.h index 2698db8e..a4269b7a 100644 --- a/src/plugin/host-bridge.h +++ b/src/plugin/host-bridge.h @@ -27,6 +27,23 @@ #include "../common/logging.h" +/** + * Boost 1.72 was released with a known breaking bug caused by a missing + * typedef: https://github.com/boostorg/process/issues/116. + * + * Luckily this is easy to fix since it's not really possible to downgrade Boost + * as it would break other applications. + * + * Check if this is still needed for other distros after Arch starts packaging + * Boost 1.73. + */ +class patched_async_pipe : public boost::process::async_pipe { + public: + using boost::process::async_pipe::async_pipe; + + typedef typename handle_type::executor_type executor_type; +}; + /** * This handles the communication between the Linux native VST plugin and the * Wine VST host. The functions below should be used as callback functions in an @@ -103,7 +120,7 @@ class HostBridge { * @param buffer The stream buffer to write to. * @param prefix Text to prepend to the line before writing to the log. */ - void async_log_pipe_lines(boost::process::async_pipe& pipe, + void async_log_pipe_lines(patched_async_pipe& pipe, boost::asio::streambuf& buffer, std::string prefix = ""); @@ -150,11 +167,11 @@ class HostBridge { /** * The STDOUT stream of the Wine process we can forward to the logger. */ - boost::process::async_pipe wine_stdout; + patched_async_pipe wine_stdout; /** * The STDERR stream of the Wine process we can forward to the logger. */ - boost::process::async_pipe wine_stderr; + patched_async_pipe wine_stderr; /** * Runs the Boost.Asio `io_context` thread for logging the Wine process * STDOUT and STDERR messages.