Skip to content

Commit debc706

Browse files
Merge #6109: fix: fix depends builds on FreeBSD hosts
bbc9957 fix: sidestep c++17 std::unary_function removal by compiling boost with c++11 (Kittywhiskers Van Gogh) 3c622a3 revert: partial dash#5610 (make depends compilable with Xcode 15 on macos) (Kittywhiskers Van Gogh) f15e1db fix: make `std::unary_function` suppression flag no longer contingent on `--enable-suppress-external-warnings` (Kittywhiskers Van Gogh) 5db84e2 revert: partial dash#3003 (Fix 2 common Travis failures which happen when Travis has network issues) (Kittywhiskers Van Gogh) Pull request description: ## Additional Information Despite builders for BSD-based platforms being backported as early as [dash#5362](#5362), they didn't work on account of using a `curl` flag, `--retry`, that was lopped off other builders in [dash#3003](#3003) as a way to mitigate aberrant Travis CI-specific behaviour. As the variable `$(DOWNLOAD_RETRIES)` was removed as part of that mitigation, the introduction of builders that rely on this variable caused failures as the flag was accompanied by nothing. As our CI host isn't based on FreeBSD, this went unnoticed. When deciding between extending the existing patch and reverting it, reverting it proved to be more attractive on account of us no longer using Travis CI and the revert bringing us closer to upstream. Additionally, the `std::unary_function` patch that was introduced in [dash#5610](#5610) proves to be necessary on BSD-based platforms as well (had to be extended for and tested on GhostBSD, based on FreeBSD 13.2-STABLE, Clang 16). Instead of conditionally patching based on platform and compiler, a more reliable patch would be to downgrade the C++ version used to build Boost at the last version to have `std::unary_function`, which would be C++11, albeit deprecated ([source](https://en.cppreference.com/w/cpp/utility/functional/unary_function)). Though it's likely this route wasn't taken originally due to compiler errors that happened despite downgrading to C++11. These errors were due to the compiler objecting to `std::unary_function` usage in Boost headers, despite the backport of [bitcoin#25436](bitcoin#25436), which should've solved this problem. The reason the errors were still persisting is because the necessary flag, `-DBOOST_NO_CXX98_FUNCTION_BASE`, was only applied if `--enable-suppress-external-warnings` was set. CI didn't catch this, as the flag is always set, to keep log lengths manageable. This has been rectified. All changes combined, one should be able to build non-Qt Dash binaries using `depends` though building the Qt client from `depends` unfortunately remains a problem, even upstream ([source](bitcoin#23955 (comment)), [source](bitcoin#23948 (comment))). ## Demo **Based on bbc9957** Built using: * **`depends` flags:** `NO_QT=1 ALLOW_HOST_PACKAGES=1 HOST=x86_64-unknown-freebsd13.2` * **`configure` flags :** `--prefix=$(pwd)/depends/x86_64-unknown-freebsd13.2 --enable-debug --enable-suppress-external-warnings --with-gui` * Qt installed using `pkg` (`qt5`) ![Dash-Qt running on GhostBSD](https://github.com/dashpay/dash/assets/63189531/608ff7e6-0e53-41a6-92dd-e31ab2c76e2e) ## Checklist: - [x] I have performed a self-review of my own code **(note: N/A)** - [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 **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: light ACK bbc9957 PastaPastaPasta: utACK bbc9957 knst: ACK bbc9957 Tree-SHA512: b29d6775f42965d2f09307aff0192012aa192e39e06a83b800613831dc00fc7173201d496117fbe86850f5208a0b7688a376f2ee618881c062c28d694085efc9
2 parents bf0df81 + bbc9957 commit debc706

File tree

6 files changed

+10
-16
lines changed

6 files changed

+10
-16
lines changed

configure.ac

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,12 @@ AX_BOOST_BASE([1.64.0],[],[AC_MSG_ERROR([Boost is not available!])])
14581458
if test x$want_boost = xno; then
14591459
AC_MSG_ERROR([[only libdashconsensus can be built without boost]])
14601460
fi
1461+
1462+
dnl Prevent use of std::unary_function, which was removed in C++17,
1463+
dnl and will generate warnings with newer compilers.
1464+
dnl See: https://github.com/boostorg/container_hash/issues/22.
1465+
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"
1466+
14611467
AX_BOOST_FILESYSTEM
14621468

14631469
dnl Opt-in to Boost Process
@@ -1471,11 +1477,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/process.hpp>]],
14711477
fi
14721478

14731479
if test x$suppress_external_warnings != xno; then
1474-
dnl Prevent use of std::unary_function, which was removed in C++17,
1475-
dnl and will generate warnings with newer compilers.
1476-
dnl See: https://github.com/boostorg/container_hash/issues/22.
1477-
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"
1478-
14791480
BOOST_CPPFLAGS=SUPPRESS_WARNINGS($BOOST_CPPFLAGS)
14801481
fi
14811482

depends/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ PATCHES_PATH = $(BASEDIR)/patches
4949
BASEDIR = $(CURDIR)
5050
HASH_LENGTH:=11
5151
DOWNLOAD_CONNECT_TIMEOUT:=30
52+
DOWNLOAD_RETRIES:=3
5253
HOST_ID_SALT ?= salt
5354
BUILD_ID_SALT ?= salt
5455

depends/builders/darwin.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build_darwin_OTOOL:=$(shell xcrun -f otool)
77
build_darwin_NM:=$(shell xcrun -f nm)
88
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
99
build_darwin_SHA256SUM=shasum -a 256
10-
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) -o
10+
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
1111

1212
#darwin host on darwin builder. overrides darwin host preferences.
1313
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -isysroot$(shell xcrun --show-sdk-path)

depends/builders/linux.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build_linux_SHA256SUM = sha256sum
2-
build_linux_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) -o
2+
build_linux_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o

depends/funcs.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ endef
3737
define fetch_file
3838
( test -f $$($(1)_source_dir)/$(4) || \
3939
( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \
40-
(sleep 5 && $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5))) || \
41-
(sleep 10 && $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5))) || \
4240
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
4341
endef
4442

depends/packages/boost.mk

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,21 @@ $(package)_config_opts_i686_android=address-model=32
2121
$(package)_config_opts_aarch64_android=address-model=64
2222
$(package)_config_opts_x86_64_android=address-model=64
2323
$(package)_config_opts_armv7a_android=address-model=32
24-
unary_function=unary_function
2524
ifneq (,$(findstring clang,$($(package)_cxx)))
2625
$(package)_toolset_$(host_os)=clang
27-
ifeq ($(build_os),darwin)
28-
unary_function=__unary_function
29-
endif
3026
else
3127
$(package)_toolset_$(host_os)=gcc
3228
endif
3329
$(package)_config_libraries=filesystem,test
34-
$(package)_cxxflags=-std=c++17
30+
$(package)_cxxflags=-std=c++11
3531
$(package)_cxxflags_linux=-fPIC
3632
$(package)_cxxflags_freebsd=-fPIC
3733
$(package)_cxxflags_openbsd=-fPIC
3834
$(package)_cxxflags_android=-fPIC
3935
$(package)_cxxflags_x86_64=-fcf-protection=full
4036
endef
4137

42-
# Fix missing unary_function in clang15 on macos, can be removed after upgrading to 1.81
4338
define $(package)_preprocess_cmds
44-
sed -i.old "s/unary_function/$(unary_function)/" boost/container_hash/hash.hpp && \
4539
echo "using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : <cflags>\"$($(package)_cflags)\" <cxxflags>\"$($(package)_cxxflags)\" <compileflags>\"$($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$($(package)_ar)\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
4640
endef
4741

0 commit comments

Comments
 (0)