Skip to content

Commit 3085f31

Browse files
Multiprocess build support
Bitcoin Core PR:bitcoin/bitcoin#16367 Pull request description: This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). This splits autotools, depends build, and travis changes out of bitcoin/bitcoin#10102, so code changes and build system changes can be reviewed separately.
1 parent f7bcb3d commit 3085f31

20 files changed

+283
-215
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
src/bitcoin
66
src/bitcoind
77
src/bitcoin-cli
8+
src/bitcoin-gui
9+
src/bitcoin-node
810
src/bitcoin-tx
911
src/bitcoin-wallet
1012
src/test/fuzz

.travis.yml

Lines changed: 0 additions & 169 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2020 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
export LC_ALL=C.UTF-8
8+
9+
export CONTAINER_NAME=ci_native_multiprocess
10+
export PACKAGES="cmake python3"
11+
export DEP_OPTS="MULTIPROCESS=1"
12+
export GOAL="install"
13+
export BITCOIN_CONFIG=""
14+
export TEST_RUNNER_ENV="BITCOIND=bitcoin-node"

ci/test/06_script_b.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fi
3131

3232
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
3333
BEGIN_FOLD unit-tests-seq
34-
DOCKER_EXEC LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib "${BASE_ROOT_DIR}/build/bitcoin-*/src/test/test_bitcoin" --catch_system_errors=no -l test_suite
34+
DOCKER_EXEC LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib ${TEST_RUNNER_ENV} test/functional/test_runner.py --ci $MAKEJOBS --tmpdirprefix "${BASE_SCRATCH_DIR}/test_runner/" --ansi --combinedlogslen=4000 ${TEST_RUNNER_EXTRA} --quiet --failfast
3535
END_FOLD
3636
fi
3737

@@ -43,6 +43,6 @@ fi
4343

4444
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
4545
BEGIN_FOLD fuzz-tests
46-
DOCKER_EXEC test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} -l DEBUG ${DIR_FUZZ_IN}
46+
DOCKER_EXEC LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} -l DEBUG ${DIR_FUZZ_IN}
4747
END_FOLD
4848
fi

configure.ac

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,24 @@ if test x$enable_bip70 != xno; then
230230
AC_MSG_ERROR([BIP70 is no longer supported!])
231231
fi
232232

233+
AC_ARG_WITH([libmultiprocess],
234+
[AS_HELP_STRING([--with-libmultiprocess=yes|no|auto],
235+
[Build with libmultiprocess library. (default: auto, i.e. detect with pkg-config)])],
236+
[with_libmultiprocess=$withval],
237+
[with_libmultiprocess=auto])
238+
239+
AC_ARG_WITH([mpgen],
240+
[AS_HELP_STRING([--with-mpgen=yes|no|auto|PREFIX],
241+
[Build with libmultiprocess codegen tool. Useful to specify different libmultiprocess host system library and build system codegen tool prefixes when cross-compiling (default is host system libmultiprocess prefix)])],
242+
[with_mpgen=$withval],
243+
[with_mpgen=auto])
244+
245+
AC_ARG_ENABLE([multiprocess],
246+
[AS_HELP_STRING([--enable-multiprocess],
247+
[build multiprocess bitcoin-node, bitcoin-wallet, and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental (default is no)])],
248+
[enable_multiprocess=$enableval],
249+
[enable_multiprocess=no])
250+
233251
AC_ARG_ENABLE(man,
234252
[AS_HELP_STRING([--disable-man],
235253
[do not install man pages (default is to install)])],,
@@ -1369,6 +1387,50 @@ AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$need_bundled_univalue = xyes])
13691387
AC_SUBST(UNIVALUE_CFLAGS)
13701388
AC_SUBST(UNIVALUE_LIBS)
13711389

1390+
dnl libmultiprocess library check
1391+
1392+
libmultiprocess_found=no
1393+
if test "x$with_libmultiprocess" = xyes || test "x$with_libmultiprocess" = xauto; then
1394+
if test "x$use_pkgconfig" = xyes; then
1395+
m4_ifdef([PKG_CHECK_MODULES], [PKG_CHECK_MODULES([LIBMULTIPROCESS], [libmultiprocess], [
1396+
libmultiprocess_found=yes;
1397+
libmultiprocess_prefix=`$PKG_CONFIG --variable=prefix libmultiprocess`;
1398+
], [true])])
1399+
fi
1400+
elif test "x$with_libmultiprocess" != xno; then
1401+
AC_MSG_ERROR([--with-libmultiprocess=$with_libmultiprocess value is not yes, auto, or no])
1402+
fi
1403+
AC_SUBST(LIBMULTIPROCESS_CFLAGS)
1404+
AC_SUBST(LIBMULTIPROCESS_LIBS)
1405+
1406+
dnl Enable multiprocess check
1407+
1408+
if test "x$enable_multiprocess" = xyes; then
1409+
if test "x$libmultiprocess_found" != xyes; then
1410+
AC_MSG_ERROR([--enable-multiprocess=yes option specified but libmultiprocess library was not found. May need to install libmultiprocess library, or specify install path with PKG_CONFIG_PATH environment variable. Running 'pkg-config --debug libmultiprocess' may be helpful for debugging.])
1411+
fi
1412+
build_multiprocess=yes
1413+
elif test "x$enable_multiprocess" = xauto; then
1414+
build_multiprocess=$libmultiprocess_found
1415+
else
1416+
build_multiprocess=no
1417+
fi
1418+
1419+
AM_CONDITIONAL([BUILD_MULTIPROCESS],[test "x$build_multiprocess" = xyes])
1420+
AM_CONDITIONAL([BUILD_BITCOIN_NODE], [test "x$build_multiprocess" = xyes])
1421+
AM_CONDITIONAL([BUILD_BITCOIN_GUI], [test "x$build_multiprocess" = xyes])
1422+
1423+
dnl codegen tools check
1424+
1425+
if test x$build_multiprocess != xno; then
1426+
if test "x$with_mpgen" = xyes || test "x$with_mpgen" = xauto; then
1427+
MPGEN_PREFIX="$libmultiprocess_prefix"
1428+
elif test "x$with_mpgen" != xno; then
1429+
MPGEN_PREFIX="$with_mpgen";
1430+
fi
1431+
AC_SUBST(MPGEN_PREFIX)
1432+
fi
1433+
13721434
AC_MSG_CHECKING([whether to build bitcoind])
13731435
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
13741436
AC_MSG_RESULT($build_bitcoind)
@@ -1650,6 +1712,7 @@ esac
16501712

16511713
echo
16521714
echo "Options used to compile and link:"
1715+
echo " multiprocess = $build_multiprocess"
16531716
echo " with wallet = $enable_wallet"
16541717
echo " with gui / qt = $bitcoin_enable_qt"
16551718
if test x$bitcoin_enable_qt != xno; then

depends/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NO_QR ?=
1313
NO_WALLET ?=
1414
NO_ZMQ ?=
1515
NO_UPNP ?=
16+
MULTIPROCESS ?=
1617
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
1718

1819
BUILD = $(shell ./config.guess)
@@ -107,6 +108,7 @@ qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch
107108
wallet_packages_$(NO_WALLET) = $(wallet_packages)
108109
upnp_packages_$(NO_UPNP) = $(upnp_packages)
109110
zmq_packages_$(NO_ZMQ) = $(zmq_packages)
111+
multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_packages)
110112

111113
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_)
112114
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
@@ -115,6 +117,11 @@ ifneq ($(zmq_packages_),)
115117
packages += $(zmq_packages)
116118
endif
117119

120+
ifeq ($(multiprocess_packages_),)
121+
packages += $(multiprocess_packages)
122+
native_packages += $(multiprocess_native_packages)
123+
endif
124+
118125
all_packages = $(packages) $(native_packages)
119126

120127
meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk
@@ -155,6 +162,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
155162
-e 's|@no_zmq@|$(NO_ZMQ)|' \
156163
-e 's|@no_wallet@|$(NO_WALLET)|' \
157164
-e 's|@no_upnp@|$(NO_UPNP)|' \
165+
-e 's|@multiprocess@|$(MULTIPROCESS)|' \
158166
-e 's|@debug@|$(DEBUG)|' \
159167
$< > $@
160168
$(AT)touch $@

depends/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ The following can be set when running make: make FOO=bar
9191
NO_ZMQ: Don't download/build/cache packages needed for enabling zeromq
9292
NO_WALLET: Don't download/build/cache libs needed to enable the wallet
9393
NO_UPNP: Don't download/build/cache packages needed for enabling upnp
94+
MULTIPROCESS: build libmultiprocess (experimental, requires cmake)
9495
DEBUG: disable some optimizations and enable more runtime checking
9596
HOST_ID_SALT: Optional salt to use when generating host package ids
9697
BUILD_ID_SALT: Optional salt to use when generating build package ids

depends/builders/darwin.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
build_darwin_CC:=$(shell xcrun -f clang)
2-
build_darwin_CXX:=$(shell xcrun -f clang++)
1+
build_darwin_CC:=clang
2+
build_darwin_CXX:=clang++
33
build_darwin_AR:=$(shell xcrun -f ar)
44
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
55
build_darwin_STRIP:=$(shell xcrun -f strip)

depends/config.site.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ fi
1616
if test -z $with_qt_bindir && test -z "@no_qt@"; then
1717
with_qt_bindir=$depends_prefix/native/bin
1818
fi
19+
if test -z $with_mpgen && test -n "@multiprocess@"; then
20+
with_mpgen=$depends_prefix/native
21+
fi
1922

2023
if test -z $with_qrencode && test -n "@no_qr@"; then
2124
with_qrencode=no
@@ -25,6 +28,10 @@ if test -z $enable_wallet && test -n "@no_wallet@"; then
2528
enable_wallet=no
2629
fi
2730

31+
if test -z $enable_multiprocess && test -n "@multiprocess@"; then
32+
enable_multiprocess=yes
33+
fi
34+
2835
if test -z $with_miniupnpc && test -n "@no_upnp@"; then
2936
with_miniupnpc=no
3037
fi

depends/funcs.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ $(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(
130130

131131
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
132132
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
133+
$(1)_config_env+=CMAKE_MODULE_PATH=$($($(1)_type)_prefix)/lib/cmake
133134
$(1)_config_env+=PATH=$(build_prefix)/bin:$(PATH)
134135
$(1)_build_env+=PATH=$(build_prefix)/bin:$(PATH)
135136
$(1)_stage_env+=PATH=$(build_prefix)/bin:$(PATH)

0 commit comments

Comments
 (0)