Skip to content

Commit 23e2bfc

Browse files
committed
Merge bitcoin/bitcoin#25696: build: Re-enable external signer on Windows
1a0d8e1 build: Re-enable external signer on Windows (Hennadii Stepanov) 989451d configure: Detect compatibility of Boost.Process rather than hardcode non-Windows (Luke Dashjr) Pull request description: As boostorg/process#207 has been resolved, it is possible now to re-enable external signer on Windows when cross-compiling. Guix build hashes: ``` 78f69ea7e0dbc8338981a92c0352220ccd7c2272d8cbff6a3b082a1412a935c5 guix-build-1a0d8e178c7b/output/aarch64-linux-gnu/SHA256SUMS.part ee17456ec818ddf5a175182508966e622573ccb518807cca43a40fa1dceda092 guix-build-1a0d8e178c7b/output/aarch64-linux-gnu/bitcoin-1a0d8e178c7b-aarch64-linux-gnu-debug.tar.gz 5080551bde379c746cc67b10429aef33b9f9e49d2d4e21ee1c3bfd9c1c845d46 guix-build-1a0d8e178c7b/output/aarch64-linux-gnu/bitcoin-1a0d8e178c7b-aarch64-linux-gnu.tar.gz dfab220ce76a40bf7dcf07aab352a616a91b516503639455fe7e1b137bad3e85 guix-build-1a0d8e178c7b/output/arm-linux-gnueabihf/SHA256SUMS.part 516ceb822571a8bd88fe107dca434ef596b1e4328ccbda1d51e1d482d3050396 guix-build-1a0d8e178c7b/output/arm-linux-gnueabihf/bitcoin-1a0d8e178c7b-arm-linux-gnueabihf-debug.tar.gz 21325380638f817107c203b9a1aedb808d1a4a2b4041493753ca4cbf19aa4f2c guix-build-1a0d8e178c7b/output/arm-linux-gnueabihf/bitcoin-1a0d8e178c7b-arm-linux-gnueabihf.tar.gz cf48ed78fcfceaeb3610ccf22326d735a129dcbf9d50b557b3de359169aefdfd guix-build-1a0d8e178c7b/output/arm64-apple-darwin/SHA256SUMS.part d4d51e136148bac6a20bb3adb402c499967647736acb420bfdeb71603aba57da guix-build-1a0d8e178c7b/output/arm64-apple-darwin/bitcoin-1a0d8e178c7b-arm64-apple-darwin-unsigned.dmg 95bb62d24f860e08a392ddb74d5860ccf27e8baa183e6749af877d26a3bd6b0b guix-build-1a0d8e178c7b/output/arm64-apple-darwin/bitcoin-1a0d8e178c7b-arm64-apple-darwin-unsigned.tar.gz 68da4c92f37bb802df37141af194f47c16da1d84f77a0fbb1016013ae0338502 guix-build-1a0d8e178c7b/output/arm64-apple-darwin/bitcoin-1a0d8e178c7b-arm64-apple-darwin.tar.gz 6704e38c2d3f11321403797598d05f062648fec6f2d76900ba250dab481e29da guix-build-1a0d8e178c7b/output/dist-archive/bitcoin-1a0d8e178c7b.tar.gz 64b936bc90d1e01fe8f276511edc9bb945dcebe70332aa37d3a786348443b8e7 guix-build-1a0d8e178c7b/output/powerpc64-linux-gnu/SHA256SUMS.part 3d03532e54b6e42498ea240c86b8567e94fd462f56087b869c3d6f09e2dde878 guix-build-1a0d8e178c7b/output/powerpc64-linux-gnu/bitcoin-1a0d8e178c7b-powerpc64-linux-gnu-debug.tar.gz c5843d79a58b0a864fe723458dab4eee54ad11f4b1f7960975b086eeedc0d541 guix-build-1a0d8e178c7b/output/powerpc64-linux-gnu/bitcoin-1a0d8e178c7b-powerpc64-linux-gnu.tar.gz f861ff519bd5e3d6d5ce1646ee0a06bcef1288ddb804a4a600e4dbfe5d5be521 guix-build-1a0d8e178c7b/output/powerpc64le-linux-gnu/SHA256SUMS.part 5f477da21980dbcf9696081903dc1ba8a3f79ce3579641d208e69a6f598c8eb9 guix-build-1a0d8e178c7b/output/powerpc64le-linux-gnu/bitcoin-1a0d8e178c7b-powerpc64le-linux-gnu-debug.tar.gz b3757b11c614136934158acea5139e8abd0c5c9cdfda72ae44db436f21716b33 guix-build-1a0d8e178c7b/output/powerpc64le-linux-gnu/bitcoin-1a0d8e178c7b-powerpc64le-linux-gnu.tar.gz 1c21bdb17fe3436e685e88c62423e630fe2b3c41dd00025a99fd80d97817ac2f guix-build-1a0d8e178c7b/output/riscv64-linux-gnu/SHA256SUMS.part f36ae98473f086ae8f0dc66223b5ec407d57dc4d8d45ae284401520ff5c0b273 guix-build-1a0d8e178c7b/output/riscv64-linux-gnu/bitcoin-1a0d8e178c7b-riscv64-linux-gnu-debug.tar.gz 1603e4d0e869eb47a1dc2d26b67772d0016d90f7ba5e50d2009365cc02cb8169 guix-build-1a0d8e178c7b/output/riscv64-linux-gnu/bitcoin-1a0d8e178c7b-riscv64-linux-gnu.tar.gz f86ef652102f022827b70477bffa0a44008c6300cf62ca7b3595146cf2ed91ba guix-build-1a0d8e178c7b/output/x86_64-apple-darwin/SHA256SUMS.part f84d435d8e4709bf29bc7ac7ed8dc6b8af4077cef05e520b468b2896ce10876a guix-build-1a0d8e178c7b/output/x86_64-apple-darwin/bitcoin-1a0d8e178c7b-x86_64-apple-darwin-unsigned.dmg af2aab969b7ed7aeea0e02adbcc9e3b438086bf76b6bfc36146c53e05a27bd57 guix-build-1a0d8e178c7b/output/x86_64-apple-darwin/bitcoin-1a0d8e178c7b-x86_64-apple-darwin-unsigned.tar.gz 32a5109ba28ab74ff66238e6a8f8a04e455ebce382a3be287df92a227818fe72 guix-build-1a0d8e178c7b/output/x86_64-apple-darwin/bitcoin-1a0d8e178c7b-x86_64-apple-darwin.tar.gz 377462e9a96f4aba72c915dd5df5159a4301a1fa8ed0ee48faa6c71573de80c3 guix-build-1a0d8e178c7b/output/x86_64-linux-gnu/SHA256SUMS.part a3bf62e828d2350a483b2d16205014f66e8884597b0b72e178042a958c548336 guix-build-1a0d8e178c7b/output/x86_64-linux-gnu/bitcoin-1a0d8e178c7b-x86_64-linux-gnu-debug.tar.gz 66cda980188ea1941a7d66c8b03c447580af33db55abe3bbe3581823ae0534a3 guix-build-1a0d8e178c7b/output/x86_64-linux-gnu/bitcoin-1a0d8e178c7b-x86_64-linux-gnu.tar.gz 2117f0dd9baeb4d585f841592e94c088f4487bf2008b8f281d0c3ceee92ff6cc guix-build-1a0d8e178c7b/output/x86_64-w64-mingw32/SHA256SUMS.part d40d5dec3287f467c42232c05d82f7fb538cda34bd2e63ff7e1876f471c3a790 guix-build-1a0d8e178c7b/output/x86_64-w64-mingw32/bitcoin-1a0d8e178c7b-win64-debug.zip 92dcc92765fbc07b1cc8258bfa69280541e1b4553cc41fed18672c2c6931d5c0 guix-build-1a0d8e178c7b/output/x86_64-w64-mingw32/bitcoin-1a0d8e178c7b-win64-setup-unsigned.exe a6dd9b4d29f21d3a18cf64556cb03446ef17bf801eb6ac257b65d27cbd95080f guix-build-1a0d8e178c7b/output/x86_64-w64-mingw32/bitcoin-1a0d8e178c7b-win64-unsigned.tar.gz a4022e595d955198f73530473ef8e90a708746089ee2dd27de794176873330c1 guix-build-1a0d8e178c7b/output/x86_64-w64-mingw32/bitcoin-1a0d8e178c7b-win64.zip ``` ACKs for top commit: Sjors: tACK 1a0d8e1 achow101: ACK 1a0d8e1 Tree-SHA512: db7319259b1e1571cfab4bb3b99ae10a2f744e62757cae5059fd6f4dd6d5586eb09feb63a0c4bb07f7128b283f1dc281ed435224bc8e40da577fd4f04cde489a
2 parents 710fd57 + 1a0d8e1 commit 23e2bfc

File tree

3 files changed

+57
-44
lines changed

3 files changed

+57
-44
lines changed

ci/test/00_setup_env_win64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export DPKG_ADD_ARCH="i386"
1313
export PACKAGES="python3 nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file"
1414
export RUN_FUNCTIONAL_TESTS=false
1515
export GOAL="deploy"
16-
export BITCOIN_CONFIG="--enable-reduce-exports --disable-external-signer --disable-gui-tests"
16+
export BITCOIN_CONFIG="--enable-reduce-exports --enable-external-signer --disable-gui-tests"

configure.ac

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,45 +1492,45 @@ if test "$use_boost" = "yes"; then
14921492
fi
14931493

14941494
if test "$use_external_signer" != "no"; then
1495-
case $host in
1496-
*mingw*)
1497-
dnl Boost Process uses Boost Filesystem when targeting Windows. Also,
1498-
dnl since Boost 1.71.0, Process does not work with mingw-w64 without
1499-
dnl workarounds. See 67669ab425b52a2b6be3d2f3b3b7e3939b676a2c.
1500-
if test "$use_external_signer" = "yes"; then
1501-
AC_MSG_ERROR([External signing is not supported on Windows])
1502-
fi
1503-
use_external_signer="no";
1504-
;;
1505-
*)
1506-
AC_MSG_CHECKING([whether Boost.Process can be used])
1507-
TEMP_CXXFLAGS="$CXXFLAGS"
1508-
dnl Boost 1.78 requires the following workaround.
1509-
dnl See: https://github.com/boostorg/process/issues/235
1510-
CXXFLAGS="$CXXFLAGS -Wno-error=narrowing"
1511-
TEMP_CPPFLAGS="$CPPFLAGS"
1512-
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
1513-
TEMP_LDFLAGS="$LDFLAGS"
1514-
dnl Boost 1.73 and older require the following workaround.
1515-
LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
1516-
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/process.hpp>]])],
1517-
[have_boost_process="yes"],
1518-
[have_boost_process="no"])
1519-
LDFLAGS="$TEMP_LDFLAGS"
1520-
CPPFLAGS="$TEMP_CPPFLAGS"
1521-
CXXFLAGS="$TEMP_CXXFLAGS"
1522-
AC_MSG_RESULT([$have_boost_process])
1523-
if test "$have_boost_process" = "yes"; then
1524-
use_external_signer="yes"
1525-
AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled])
1526-
else
1527-
if test "$use_external_signer" = "yes"; then
1528-
AC_MSG_ERROR([External signing is not supported for this Boost version])
1529-
fi
1530-
use_external_signer="no";
1531-
fi
1532-
;;
1533-
esac
1495+
AC_MSG_CHECKING([whether Boost.Process can be used])
1496+
TEMP_CXXFLAGS="$CXXFLAGS"
1497+
dnl Boost 1.78 requires the following workaround.
1498+
dnl See: https://github.com/boostorg/process/issues/235
1499+
CXXFLAGS="$CXXFLAGS -Wno-error=narrowing"
1500+
TEMP_CPPFLAGS="$CPPFLAGS"
1501+
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
1502+
TEMP_LDFLAGS="$LDFLAGS"
1503+
dnl Boost 1.73 and older require the following workaround.
1504+
LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
1505+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1506+
#define BOOST_PROCESS_USE_STD_FS
1507+
#include <boost/process.hpp>
1508+
]],[[
1509+
namespace bp = boost::process;
1510+
bp::opstream stdin_stream;
1511+
bp::ipstream stdout_stream;
1512+
bp::child c("dummy", bp::std_out > stdout_stream, bp::std_err > stdout_stream, bp::std_in < stdin_stream);
1513+
stdin_stream << std::string{"test"} << std::endl;
1514+
if (c.running()) c.terminate();
1515+
c.wait();
1516+
c.exit_code();
1517+
]])],
1518+
[have_boost_process="yes"],
1519+
[have_boost_process="no"])
1520+
LDFLAGS="$TEMP_LDFLAGS"
1521+
CPPFLAGS="$TEMP_CPPFLAGS"
1522+
CXXFLAGS="$TEMP_CXXFLAGS"
1523+
AC_MSG_RESULT([$have_boost_process])
1524+
if test "$have_boost_process" = "yes"; then
1525+
use_external_signer="yes"
1526+
AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled])
1527+
AC_DEFINE([BOOST_PROCESS_USE_STD_FS], [1], [Defined to avoid Boost::Process trying to use Boost Filesystem])
1528+
else
1529+
if test "$use_external_signer" = "yes"; then
1530+
AC_MSG_ERROR([External signing is not supported for this Boost version])
1531+
fi
1532+
use_external_signer="no";
1533+
fi
15341534
fi
15351535
AM_CONDITIONAL([ENABLE_EXTERNAL_SIGNER], [test "$use_external_signer" = "yes"])
15361536

src/test/system_tests.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ BOOST_AUTO_TEST_CASE(dummy)
3434

3535
BOOST_AUTO_TEST_CASE(run_command)
3636
{
37+
#ifdef WIN32
38+
// https://www.winehq.org/pipermail/wine-devel/2008-September/069387.html
39+
auto hntdll = GetModuleHandleA("ntdll.dll");
40+
assert(hntdll);
41+
const bool wine_runtime = GetProcAddress(hntdll, "wine_get_version");
42+
#endif
43+
3744
{
3845
const UniValue result = RunCommandParseJSON("");
3946
BOOST_CHECK(result.isNull());
@@ -51,29 +58,35 @@ BOOST_AUTO_TEST_CASE(run_command)
5158
}
5259
{
5360
// An invalid command is handled by Boost
61+
#ifdef WIN32
62+
const int expected_error{wine_runtime ? 6 : 2};
63+
#else
64+
const int expected_error{2};
65+
#endif
5466
BOOST_CHECK_EXCEPTION(RunCommandParseJSON("invalid_command"), boost::process::process_error, [&](const boost::process::process_error& e) {
5567
BOOST_CHECK(std::string(e.what()).find("RunCommandParseJSON error:") == std::string::npos);
56-
BOOST_CHECK_EQUAL(e.code().value(), 2);
68+
BOOST_CHECK_EQUAL(e.code().value(), expected_error);
5769
return true;
5870
});
5971
}
6072
{
6173
// Return non-zero exit code, no output to stderr
6274
#ifdef WIN32
63-
const std::string command{"cmd.exe /c call"};
75+
const std::string command{"cmd.exe /c exit 1"};
6476
#else
6577
const std::string command{"false"};
6678
#endif
6779
BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) {
68-
BOOST_CHECK(std::string(e.what()).find(strprintf("RunCommandParseJSON error: process(%s) returned 1: \n", command)) != std::string::npos);
80+
const std::string what{e.what()};
81+
BOOST_CHECK(what.find(strprintf("RunCommandParseJSON error: process(%s) returned 1: \n", command)) != std::string::npos);
6982
return true;
7083
});
7184
}
7285
{
7386
// Return non-zero exit code, with error message for stderr
7487
#ifdef WIN32
7588
const std::string command{"cmd.exe /c dir nosuchfile"};
76-
const std::string expected{"File Not Found"};
89+
const std::string expected{wine_runtime ? "File not found." : "File Not Found"};
7790
#else
7891
const std::string command{"ls nosuchfile"};
7992
const std::string expected{"No such file or directory"};

0 commit comments

Comments
 (0)