Skip to content

Commit 9590d57

Browse files
8e79c7a fix: allow `dbghelp.dll` for PE targets (Kittywhiskers Van Gogh) f97d3d6 fix: skip `EXPORTED_SYMBOLS` validation on ELF targets (Kittywhiskers Van Gogh) d5dffb6 merge bitcoin#33580: Use $(package)_file_name when downloading from the fallback (Kittywhiskers Van Gogh) b7febbe merge bitcoin#30137: Remove `--enable-threadlocal` (Kittywhiskers Van Gogh) dcf67c7 merge bitcoin#30095: avoid using thread_local variable that has a destructor (Kittywhiskers Van Gogh) 4e57d1a merge bitcoin#32266: Avoid `warning: "_FORTIFY_SOURCE"` redefined for `libevent` (Kittywhiskers Van Gogh) 6e66ef8 merge bitcoin#32837: fix libevent `_WIN32_WINNT` usage (Kittywhiskers Van Gogh) 61f2a23 merge bitcoin#32716: Override host compilers for FreeBSD and OpenBSD (Kittywhiskers Van Gogh) ca52975 merge bitcoin#32731: Build `qt` package for FreeBSD hosts (Kittywhiskers Van Gogh) ee9e934 build: check against `$host` instead of `TARGET_OS` in stacktrace search (Kittywhiskers Van Gogh) 44d32a3 merge bitcoin#32690: fix multiprocess build on OpenBSD (apply capnp patch, correct SHA256SUM command) (Kittywhiskers Van Gogh) 8d90c3c merge bitcoin#32568: use "mkdir -p" when installing xproto (Kittywhiskers Van Gogh) d4bc0aa merge bitcoin#32505: bump to latest config.guess and config.sub (Kittywhiskers Van Gogh) 6020cdc merge bitcoin#31998: patch around PlacementNew issue in capnp (Kittywhiskers Van Gogh) 00350a0 merge bitcoin#32086: Shuffle depends instructions and recommend modern make for macOS (Kittywhiskers Van Gogh) c8e27a2 merge bitcoin#31982: rename libmultiprocess repository (Kittywhiskers Van Gogh) 86d0a27 merge bitcoin#30584: Make default `host` and `build` comparable (Kittywhiskers Van Gogh) e6d6d17 merge bitcoin#31840: add missing Darwin objcopy (Kittywhiskers Van Gogh) 8d887c3 merge bitcoin#31626: Use base system's `sha256sum` utility on FreeBSD (Kittywhiskers Van Gogh) b443c14 partial bitcoin#30454: Introduce CMake-based build system (Kittywhiskers Van Gogh) 67aa238 merge bitcoin#31100: remove dependency install instructions from win docs (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependent on #6918 * Dependency for #6927 * [dash#6966](#6966) broke Guix build post-compilation binary verification for ELF and PE binaries as * For PE binaries, with improved `libbacktrace` detection, we are now building the capability in Windows binaries and that introduces a dependency on `dbghelp.dll` ([source](https://github.com/dashpay/dash/blob/edcb9f265b63693a8e684bd22fba5555434eff62/configure.ac)) that wasn't in the `PE_ALLOWED_LIBRARIES` allowlist, it has since been added. * For ELF binaries, now that we use `-export-dynamic` for symbol preservation, the `EXPORTED_SYMBOLS` check now fails. As the diagnostic value of retaining these symbols far exceeds the file size reduction, we have opted to comment out the test entirely. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: re-utACK 8e79c7a Tree-SHA512: 08f904dfcbf4ece848fe805395d78b3615ff40ed5d4df3afa73576de8960ccee5c70547495aefba54cd7b01dceefe0933831640484b0996468189da265dc711b
2 parents d8bb2a0 + 8e79c7a commit 9590d57

30 files changed

+1115
-390
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
148148
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QWindowsIntegrationPlugin], [-lqwindows])
149149
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QWindowsVistaStylePlugin], [-lqwindowsvistastyle])
150150
AC_DEFINE([QT_QPA_PLATFORM_WINDOWS], [1], [Define this symbol if the qt platform is windows])
151-
elif test "$TARGET_OS" = "linux"; then
151+
elif test "$TARGET_OS" = "linux" -o "$TARGET_OS" = "freebsd"; then
152152
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QXcbIntegrationPlugin], [-lqxcb])
153153
AC_DEFINE([QT_QPA_PLATFORM_XCB], [1], [Define this symbol if the qt platform is xcb])
154154
elif test "$TARGET_OS" = "darwin"; then

configure.ac

Lines changed: 15 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ AC_ARG_ENABLE([lcov-branch-coverage],
237237
[use_lcov_branch=yes],
238238
[use_lcov_branch=no])
239239

240-
AC_ARG_ENABLE([threadlocal],
241-
[AS_HELP_STRING([--enable-threadlocal],
242-
[enable features that depend on the c++ thread_local keyword (currently just thread names in debug logs). (default is to enable if there is platform support)])],
243-
[use_thread_local=$enableval],
244-
[use_thread_local=auto])
245-
246240
AC_ARG_ENABLE([zmq],
247241
[AS_HELP_STRING([--disable-zmq],
248242
[disable ZMQ notifications])],
@@ -952,8 +946,8 @@ case $host in
952946
*linux*)
953947
TARGET_OS=linux
954948
;;
955-
*bsd*)
956-
TARGET_OS=bsd
949+
*freebsd*)
950+
TARGET_OS=freebsd
957951
;;
958952
esac
959953

@@ -1192,45 +1186,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11921186
[AC_MSG_RESULT([no])]
11931187
)
11941188

1195-
if test "$use_thread_local" = "yes" || test "$use_thread_local" = "auto"; then
1196-
TEMP_LDFLAGS="$LDFLAGS"
1197-
LDFLAGS="$TEMP_LDFLAGS $PTHREAD_CFLAGS"
1198-
AC_MSG_CHECKING([for thread_local support])
1199-
AC_LINK_IFELSE([AC_LANG_SOURCE([
1200-
#include <thread>
1201-
static thread_local int foo = 0;
1202-
static void run_thread() { foo++;}
1203-
int main(){
1204-
for(int i = 0; i < 10; i++) { std::thread(run_thread).detach();}
1205-
return foo;
1206-
}
1207-
])],
1208-
[
1209-
case $host in
1210-
*mingw*)
1211-
dnl mingw32's implementation of thread_local has also been shown to behave
1212-
dnl erroneously under concurrent usage; see:
1213-
dnl https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605
1214-
AC_MSG_RESULT([no])
1215-
;;
1216-
*freebsd*)
1217-
dnl FreeBSD's implementation of thread_local is also buggy (per
1218-
dnl https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ)
1219-
AC_MSG_RESULT([no])
1220-
;;
1221-
*)
1222-
AC_DEFINE([HAVE_THREAD_LOCAL], [1], [Define if thread_local is supported.])
1223-
AC_MSG_RESULT([yes])
1224-
;;
1225-
esac
1226-
],
1227-
[
1228-
AC_MSG_RESULT([no])
1229-
]
1230-
)
1231-
LDFLAGS="$TEMP_LDFLAGS"
1232-
fi
1233-
12341189
BACKTRACE_FLAGS=
12351190
BACKTRACE_LDFLAGS=
12361191
BACKTRACE_LIBS=
@@ -1240,17 +1195,19 @@ if test "$enable_stacktraces" != "no"; then
12401195
BACKTRACE_LIBS="$BACKTRACE_LIBS -ldbghelp"
12411196
else
12421197
AC_CHECK_HEADERS([execinfo.h], [
1243-
if test "$TARGET_OS" = "bsd"; then
1244-
AC_SEARCH_LIBS([backtrace], [execinfo], [
1245-
BACKTRACE_LIBS="$BACKTRACE_LIBS -lexecinfo"
1246-
], [
1247-
if test "$enable_stacktraces" = "yes"; then
1248-
AC_MSG_ERROR([--enable-stacktraces was specified but cannot locate libexecinfo])
1249-
fi
1250-
AC_MSG_WARN([cannot locate libexecinfo, stacktraces will be disabled])
1251-
enable_stacktraces=no
1252-
])
1253-
fi
1198+
case $host in
1199+
*bsd*)
1200+
AC_SEARCH_LIBS([backtrace], [execinfo], [
1201+
BACKTRACE_LIBS="$BACKTRACE_LIBS -lexecinfo"
1202+
], [
1203+
if test "$enable_stacktraces" = "yes"; then
1204+
AC_MSG_ERROR([--enable-stacktraces was specified but cannot locate libexecinfo])
1205+
fi
1206+
AC_MSG_WARN([cannot locate libexecinfo, stacktraces will be disabled])
1207+
enable_stacktraces=no
1208+
])
1209+
;;
1210+
esac
12541211
AX_CHECK_LINK_FLAG([-Wl,-export-dynamic], [BACKTRACE_LDFLAGS="$BACKTRACE_LDFLAGS -Wl,-export-dynamic"], [
12551212
AX_CHECK_LINK_FLAG([-rdynamic], [BACKTRACE_LDFLAGS="$BACKTRACE_LDFLAGS -rdynamic"], [
12561213
if test "$enable_stacktraces" = "yes"; then

contrib/devtools/symbol-check.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@
163163
'msvcrt.dll', # C standard library for MSVC
164164
'SHELL32.dll', # shell API
165165
'WS2_32.dll', # sockets
166-
'bcrypt.dll',
166+
'bcrypt.dll', # crypto API
167+
'dbghelp.dll', # debugging routines
167168
# bitcoin-qt only
168169
'dwmapi.dll', # desktop window manager
169170
'GDI32.dll', # graphics device interface
@@ -285,7 +286,8 @@ def check_ELF_ABI(binary) -> bool:
285286
CHECKS = {
286287
lief.EXE_FORMATS.ELF: [
287288
('IMPORTED_SYMBOLS', check_imported_symbols),
288-
('EXPORTED_SYMBOLS', check_exported_symbols),
289+
# Dash: We export symbols aggressively to aid in backtrace generation
290+
# ('EXPORTED_SYMBOLS', check_exported_symbols),
289291
('LIBRARY_DEPENDENCIES', check_ELF_libraries),
290292
('INTERPRETER_NAME', check_ELF_interpreter),
291293
('ABI', check_ELF_ABI),

depends/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ C_STANDARD ?= c11
5252
CXX_STANDARD ?= c++20
5353

5454
BUILD = $(shell ./config.guess)
55-
HOST ?= $(BUILD)
5655
PATCHES_PATH = $(BASEDIR)/patches
5756
BASEDIR = $(CURDIR)
5857
HASH_LENGTH:=11
@@ -61,11 +60,6 @@ DOWNLOAD_RETRIES:=3
6160
HOST_ID_SALT ?= salt
6261
BUILD_ID_SALT ?= salt
6362

64-
host:=$(BUILD)
65-
ifneq ($(HOST),)
66-
host:=$(HOST)
67-
endif
68-
6963
ifneq ($(DEBUG),)
7064
release_type=debug
7165
else
@@ -75,9 +69,15 @@ endif
7569
base_build_dir=$(WORK_PATH)/build
7670
base_staging_dir=$(WORK_PATH)/staging
7771
base_download_dir=$(WORK_PATH)/download
78-
canonical_host:=$(shell ./config.sub $(HOST))
7972
build:=$(shell ./config.sub $(BUILD))
8073

74+
host:=$(build)
75+
ifneq ($(HOST),)
76+
host:=$(HOST)
77+
endif
78+
HOST ?= $(BUILD)
79+
canonical_host:=$(shell ./config.sub $(HOST))
80+
8181
build_arch =$(firstword $(subst -, ,$(build)))
8282
build_vendor=$(word 2,$(subst -, ,$(build)))
8383
full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))

depends/README.md

Lines changed: 97 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,59 @@
1-
### Usage
1+
# Depends build
2+
3+
This is a system of building and caching dependencies necessary for building
4+
Dash Core. It supports cross-compilation. For more details see [description.md](description.md),
5+
as well as [packages.md](packages.md) for how to add packages.
6+
7+
## Usage
8+
9+
### Ubuntu & Debian
10+
11+
apt install automake bison cmake curl libtool make patch pkg-config python3 xz-utils
212

313
To build dependencies for the current arch+OS:
414

515
make
616

7-
To build for another arch/OS:
17+
### macOS
818

9-
make HOST=host-platform-triplet
19+
Install Xcode Command Line Tools and Homebrew Package Manager,
20+
see [build-osx.md](../doc/build-osx.md).
1021

11-
For example:
22+
brew install cmake make ninja
1223

13-
make HOST=x86_64-w64-mingw32 -j4
24+
To build dependencies for the current arch+OS:
25+
26+
gmake
27+
28+
### FreeBSD
29+
30+
pkg install bash
31+
32+
Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):
33+
34+
pkg install bison ninja pkgconf python3
35+
36+
To build dependencies for the current arch+OS:
37+
38+
gmake
39+
40+
### NetBSD
41+
42+
pkgin install bash gmake
43+
44+
To build dependencies for the current arch+OS:
45+
46+
gmake
47+
48+
### OpenBSD
49+
50+
pkg_add bash gmake gtar
51+
52+
To build dependencies for the current arch+OS:
53+
54+
gmake
55+
56+
## Configuring Dash Core
1457

1558
**Dash Core's `configure` script by default will ignore the depends output.** In
1659
order for it to pick up libraries, tools, and settings from the depends build,
@@ -23,6 +66,53 @@ created. To use it during compilation:
2366
The default install prefix when using `config.site` is `--prefix=depends/<host-platform-triplet>`,
2467
so depends build outputs will be installed in that location.
2568

69+
## Dependency Options
70+
71+
The following can be set when running make: `make FOO=bar`
72+
73+
- `SOURCES_PATH`: Downloaded sources will be placed here
74+
- `BASE_CACHE`: Built packages will be placed here
75+
- `SDK_PATH`: Path where SDKs can be found (used by macOS)
76+
- `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up
77+
- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.
78+
- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`.
79+
- `NO_BOOST`: Don't download/build/cache Boost
80+
- `NO_LIBEVENT`: Don't download/build/cache Libevent
81+
- `NO_QT`: Don't download/build/cache Qt and its dependencies
82+
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode
83+
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ
84+
- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet
85+
- `NO_BDB`: Don't download/build/cache BerkeleyDB
86+
- `NO_SQLITE`: Don't download/build/cache SQLite
87+
- `NO_UPNP`: Don't download/build/cache packages needed for enabling UPnP
88+
- `NO_NATPMP`: Don't download/build/cache packages needed for enabling NAT-PMP
89+
- `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints
90+
- `ALLOW_HOST_PACKAGES`: Packages that are missed in dependencies (due to `NO_*` option or
91+
build script logic) are searched for among the host system packages using
92+
`pkg-config`. It allows building with packages of other (newer) versions
93+
- `MULTIPROCESS`: build libmultiprocess (experimental, requires cmake)
94+
- `DEBUG`: Disable some optimizations and enable more runtime checking
95+
- `HOST_ID_SALT`: Optional salt to use when generating host package ids
96+
- `BUILD_ID_SALT`: Optional salt to use when generating build package ids
97+
- `LOG`: Use file-based logging for individual packages. During a package build its log file
98+
resides in the `depends` directory, and the log file is printed out automatically in case
99+
of build error. After successful build log files are moved along with package archives
100+
- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.
101+
- `NO_HARDEN=1`: Don't use hardening options when building packages
102+
103+
If some packages are not built, for example `make NO_WALLET=1`, the appropriate
104+
options will be passed to Dash Core's configure. In this case, `--disable-wallet`.
105+
106+
## Cross compilation
107+
108+
To build for another arch/OS:
109+
110+
make HOST=host-platform-triplet
111+
112+
For example:
113+
114+
make HOST=x86_64-w64-mingw32 -j4
115+
26116
Common `host-platform-triplet`s for cross compilation are:
27117

28118
- `i686-pc-linux-gnu` for Linux 32 bit
@@ -41,13 +131,7 @@ Common `host-platform-triplet`s for cross compilation are:
41131
- `aarch64-linux-android` for Android ARM 64 bit
42132
- `x86_64-linux-android` for Android x86 64 bit
43133

44-
The paths are automatically configured and no other options are needed unless targeting [Android](../doc/build-android.md).
45-
46-
### Install the required dependencies: Ubuntu & Debian
47-
48-
#### Common
49-
50-
apt install automake bison cmake curl libtool make patch pkg-config python3 xz-utils
134+
The paths are automatically configured and no other options are needed.
51135

52136
#### For macOS cross compilation
53137

@@ -60,7 +144,7 @@ For more information, see [SDK Extraction](../contrib/macdeploy/README.md#sdk-ex
60144

61145
#### For Win64 cross compilation
62146

63-
- see [build-windows.md](../doc/build-windows.md#cross-compilation-for-ubuntu-and-windows-subsystem-for-linux)
147+
apt install g++-mingw-w64-x86-64-posix
64148

65149
#### For linux (including i386, ARM) cross compilation
66150

@@ -88,60 +172,9 @@ For linux S390X cross compilation:
88172

89173
sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu
90174

91-
### Install the required dependencies: FreeBSD
92-
93-
pkg install bash
94-
95-
### Install the required dependencies: OpenBSD
96-
97-
pkg_add bash gtar
98-
99-
### Dependency Options
100-
101-
The following can be set when running make: `make FOO=bar`
102-
103-
- `SOURCES_PATH`: Downloaded sources will be placed here
104-
- `BASE_CACHE`: Built packages will be placed here
105-
- `SDK_PATH`: Path where SDKs can be found (used by macOS)
106-
- `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up
107-
- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.
108-
- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`.
109-
- `NO_BOOST`: Don't download/build/cache Boost
110-
- `NO_LIBEVENT`: Don't download/build/cache Libevent
111-
- `NO_QT`: Don't download/build/cache Qt and its dependencies
112-
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode
113-
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ
114-
- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet
115-
- `NO_BDB`: Don't download/build/cache BerkeleyDB
116-
- `NO_SQLITE`: Don't download/build/cache SQLite
117-
- `NO_UPNP`: Don't download/build/cache packages needed for enabling UPnP
118-
- `NO_NATPMP`: Don't download/build/cache packages needed for enabling NAT-PMP
119-
- `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints
120-
- `ALLOW_HOST_PACKAGES`: Packages that are missed in dependencies (due to `NO_*` option or
121-
build script logic) are searched for among the host system packages using
122-
`pkg-config`. It allows building with packages of other (newer) versions
123-
- `MULTIPROCESS`: build libmultiprocess (experimental, requires cmake)
124-
- `DEBUG`: Disable some optimizations and enable more runtime checking
125-
- `HOST_ID_SALT`: Optional salt to use when generating host package ids
126-
- `BUILD_ID_SALT`: Optional salt to use when generating build package ids
127-
- `LOG`: Use file-based logging for individual packages. During a package build its log file
128-
resides in the `depends` directory, and the log file is printed out automatically in case
129-
of build error. After successful build log files are moved along with package archives
130-
- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.
131-
- `NO_HARDEN=1`: Don't use hardening options when building packages
132-
133-
If some packages are not built, for example `make NO_WALLET=1`, the appropriate
134-
options will be passed to Dash Core's configure. In this case, `--disable-wallet`.
135-
136175
### Additional targets
137176

138177
download: run 'make download' to fetch all sources without building them
139178
download-osx: run 'make download-osx' to fetch all sources needed for macOS builds
140179
download-win: run 'make download-win' to fetch all sources needed for win builds
141180
download-linux: run 'make download-linux' to fetch all sources needed for linux builds
142-
143-
144-
### Other documentation
145-
146-
- [description.md](description.md): General description of the depends system
147-
- [packages.md](packages.md): Steps for adding packages

depends/builders/freebsd.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
build_freebsd_CC=clang
22
build_freebsd_CXX=clang++
33

4-
build_freebsd_SHA256SUM = shasum -a 256
4+
build_freebsd_SHA256SUM = sha256sum
55
build_freebsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
6+
7+
# freebsd host on freebsd builder: override freebsd host preferences.
8+
freebsd_CC = clang
9+
freebsd_CXX = clang++

depends/builders/openbsd.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
build_openbsd_CC = clang
22
build_openbsd_CXX = clang++
33

4-
build_openbsd_SHA256SUM = sha256
4+
build_openbsd_SHA256SUM = sha256 -r
55
build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
66

77
build_openbsd_TAR = gtar
88
# openBSD touch doesn't understand -h
99
build_openbsd_TOUCH = touch -m -t 200001011200
10+
11+
# openbsd host on openbsd builder: override openbsd host preferences.
12+
openbsd_CC = clang
13+
openbsd_CXX = clang++

0 commit comments

Comments
 (0)