Skip to content

Commit

Permalink
Merge #6516: backport: merge bitcoin#24866, bitcoin#25612, bitcoin#28432
Browse files Browse the repository at this point in the history
, bitcoin#28757, bitcoin#28845, bitcoin#28932, bitcoin#28973, bitcoin#21778, bitcoin#30204, bitcoin#29765, bitcoin#30201, bitcoin#30287, bitcoin#30511 (toolchain backports: part 3)

ee04e1f merge bitcoin#30511: GCC 12 consolidation (Kittywhiskers Van Gogh)
cc5c30e merge bitcoin#30287: rewrite some docs & swap `mmacosx-version-min` for `mmacos-version-min` (Kittywhiskers Van Gogh)
632b8b4 merge bitcoin#30201: remove `FORCE_USE_SYSTEM_CLANG` (Kittywhiskers Van Gogh)
994e7b1 merge bitcoin#29765: Use clang-18 (Kittywhiskers Van Gogh)
7e7d7bd merge bitcoin#30204: consolidate dependency docs (Kittywhiskers Van Gogh)
061a608 merge bitcoin#21778: LLD based macOS toolchain (Kittywhiskers Van Gogh)
ea891d4 fix: use `LDFLAGS` when compiling `gmp`'s `configure` test programs (Kittywhiskers Van Gogh)
c2fe7c6 merge bitcoin#28973: remove `libz-dev` from macOS build deps (Kittywhiskers Van Gogh)
62e671d merge bitcoin#28932: remove `python3-setuptools` from macOS build deps (Kittywhiskers Van Gogh)
5bef1e5 merge bitcoin#28845: remove `PYTHONPATH` from config.site (Kittywhiskers Van Gogh)
c501a0d merge bitcoin#28757: Zip needs to include all files and set time to SOURCE_DATE_EPOCH (Kittywhiskers Van Gogh)
122a61f merge bitcoin#28432: Produce a `.zip` for macOS distribution (Kittywhiskers Van Gogh)
407deab merge bitcoin#25612: default to using GCC tool wrappers for LTO (with GCC) (Kittywhiskers Van Gogh)
f0a0040 fix: ensure that `dsymutil` available even when `FORCE_USE_SYSTEM_CLANG=1` (Kittywhiskers Van Gogh)
416e154 merge bitcoin#24866: No longer need to hack the PATH variable in `config.site` (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Depends on #6385

  * Omissions related to explicitly defining the location of `DSYMUTIL` (see [dash#6384](#6384) for more information) have been remedied and are now included (completing [bitcoin#24866](bitcoin#24866) and [bitcoin#25612](bitcoin#25612) in this pull request), courtesy of a fix that defines `DSYMUTIL` even when `FORCE_USE_SYSTEM_CLANG` is defined ([commit](f0a0040)).
    * This fix is effectively reverted in [bitcoin#21778](bitcoin#21778) as the backport ensures that `DSYMUTIL` is defined in the `FORCE_USE_SYSTEM_CLANG` case and `cctools` is no longer used.
    * It still remains to allow testing and validation of commits pre-[bitcoin#21778](bitcoin#21778).

  * GMP runs its test programs during build configuration sans `LDFLAGS` ([source](https://github.com/gmp-mirror/gmp/blob/141ed4f98a50e4a3c1a95a1758cb599b7499ac39/acinclude.m4#L1755)), which are quite important when using an LLD-based toolchain as we rely on it to take on `ld64`'s duties ([source](https://lld.llvm.org/MachO/index.html)) using `-fuse-ld=lld` ([source](https://lld.llvm.org/#using-lld)). This has been remedied by patching `acinclude.m4` and `configure.ac` to include `LDFLAGS`.

    <details>

    <summary>configure failure:</summary>

     ```
     checking build system type... x86_64-pc-linux-gnu
     checking host system type... x86_64-apple-darwin
     checking for a BSD-compatible install... /home/debian/.guix-profile/bin/install -c
     checking whether build environment is sane... yes
     checking for x86_64-apple-darwin-strip... no
     checking for strip... strip
     configure: WARNING: using cross tools not prefixed with host triplet
     checking for a thread-safe mkdir -p... /home/debian/.guix-profile/bin/mkdir -p
     checking for gawk... gawk
     checking whether make sets $(MAKE)... yes
     checking whether make supports nested variables... yes
     checking whether to enable maintainer-specific portions of Makefiles... no
     checking ABI=64
     checking whether env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks is gcc... yes
     checking compiler env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -pipe -std=c11 -mmacos-version-min=11.0 -mlinker-version=711 -O2 -march=x86-64    -I/dash/depends/x86_64-apple-darwin/include... no
     checking ABI=x32
     checking whether env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks is gcc... yes
     checking compiler env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -pipe -std=c11 -mmacos-version-min=11.0 -mlinker-version=711 -O2 -march=x86-64    -I/dash/depends/x86_64-apple-darwin/include... no
     checking ABI=32
     checking whether env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks is gcc... yes
     checking compiler env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -pipe -std=c11 -mmacos-version-min=11.0 -mlinker-version=711 -O2 -march=x86-64    -I/dash/depends/x86_64-apple-darwin/include... no
     configure: error: could not find a working compiler, see config.log for details
     make: *** [funcs.mk:302: /dash/depends/x86_64-apple-darwin/.gmp_stamp_configured] Error 1
     make: Leaving directory '/dash/depends'
     ```

    </details>

    <details>

    <summary>config.log excerpt:</summary>

     ```
     This file contains any messages produced by compilers while
     running configure, to aid debugging if configure makes a mistake.

     It was created by GNU MP configure 6.3.0, which was
     generated by GNU Autoconf 2.69.  Invocation command line was

     [...]

     ## --------- ##
     ## Platform. ##
     ## --------- ##

     hostname = [...]
     uname -m = x86_64
     uname -r = 6.6.32[...]
     uname -s = Linux
     uname -v = #1 SMP PREEMPT_DYNAMIC Mon Jul  8 16:11:58 UTC 2024

     /usr/bin/uname -p = unknown
     /bin/uname -X     = unknown

     /bin/arch              = unknown
     /usr/bin/arch -k       = unknown
     /usr/convex/getsysinfo = unknown
     /usr/bin/hostinfo      = unknown
     /bin/machine           = unknown
     /usr/bin/oslevel       = unknown
     /bin/universe          = unknown

     PATH: /dash/depends/x86_64-apple-darwin/native/bin
     PATH: /home/debian/.guix-profile/bin
     PATH: /home/debian/.guix-profile/sbin

     ## ----------- ##
     ## Core tests. ##
     ## ----------- ##

     [...]
     configure:5889: env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -c conftest.c >&5
     configure:5892: $? = 0
     configure:5895: checking whether env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks is gcc
     configure:5897: result: yes
     configure:5911: env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks 2>&1 | grep xlc >/dev/null
     configure:5914: $? = 1
     configure:5968: checking compiler env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -pipe -std=c11 -mmacos-version-min=11.0 -mlinker-version=711 -O2 -march=x86-64   -I/dash/depends/x86_64-apple-darwin/include
     Test compile:
     configure:5982: env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/debian/.guix-profile/bin/clang --target=x86_64-apple-darwin -isysroot/dash/depends/SDKs/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers -nostdlibinc -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -pipe -std=c11 -mmacos-version-min=11.0 -mlinker-version=711 -O2 -march=x86-64   -I/dash/depends/x86_64-apple-darwin/include conftest.c >&5
     ld: unrecognized option '-dynamic'
     ld: use the --help option for usage information
     clang: error: linker command failed with exit code 1 (use -v to see invocation)
     configure:5985: $? = 1
     failed program was:

     int main () { return 0; }
     configure:7072: result: no
     [...]
     configure:7310: error: could not find a working compiler, see config.log for details
     [...]

     ## ---------------- ##
     ## Cache variables. ##
     ## ---------------- ##

     [...]
     ac_cv_env_LDFLAGS_set=set
     ac_cv_env_LDFLAGS_value='-Wl,-platform_version,macos,11.0,14.0 -Wl,-no_adhoc_codesign -fuse-ld=lld  -L/dash/depends/x86_64-apple-darwin/lib'
     [...]
     LD=''
     LDFLAGS='-Wl,-platform_version,macos,11.0,14.0 -Wl,-no_adhoc_codesign -fuse-ld=lld  -L/dash/depends/x86_64-apple-darwin/lib'
     [...]

     ## ----------- ##
     ## confdefs.h. ##
     ## ----------- ##

     /* confdefs.h */
     #define PACKAGE_NAME "GNU MP"
     #define PACKAGE_TARNAME "gmp"
     #define PACKAGE_VERSION "6.3.0"
     #define PACKAGE_STRING "GNU MP 6.3.0"
     #define PACKAGE_BUGREPORT "[email protected] (see https://gmplib.org/manual/Reporting-Bugs.html)"
     #define PACKAGE_URL "http://www.gnu.org/software/gmp/"
     #define PACKAGE "gmp"
     #define VERSION "6.3.0"
     #define WANT_FFT 1
     #define HAVE_HOST_CPU_x86_64 1

     configure: exit 1
     ```

     **Note:** `lld` itself will never respond like this, as it will exit with a catch-all message requesting you to invoke it with the correct name

     ```
     $ lld -dynamic
     lld is a generic driver.
     Invoke ld.lld (Unix), ld64.lld (macOS), lld-link (Windows), wasm-ld (WebAssembly) instead
     ```

     Nor is it calling the Unix-specific variant mistakenly

     ```
     $ ld.lld -dynamic
     ld.lld: error: unknown argument '-dynamic', did you mean '-Bdynamic'
     ```

     The error displayed above is consistent with GNU `ld`
     ```
     $ ld -dynamic
     ld: unrecognized option '-dynamic'
     ld: use the --help option for usage information
     ```

    </details>

    * A similar problem is observed for Qt, which was resolved upstream by adding it to `CXXFLAGS` ([source](https://github.com/bitcoin/bitcoin/blob/e8c25e8a35e333e90514945c592557615641553f/depends/patches/qt/mac-qmake.conf#L16)) (but this comes at the downside of an unused argument warnings whenever the compiler doesn't intend to do any linking and is why we didn't just modify `darwin_{CC,CXX}` instead)

      <details>

      <summary>Warning messages when building Qt:</summary>

      ```
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      compiling kernel/qplatformcursor.cpp
      compiling kernel/qplatformclipboard.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      compiling kernel/qplatformsurface.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      4 warnings generated.
      compiling kernel/qcursor.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      compiling kernel/qguivariant.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      compiling kernel/qshortcutmap.cpp
      compiling kernel/qtouchdevice.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      compiling kernel/qplatformservices.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      kernel/qplatformcursor.cpp:622:17: warning: variable 'w' set but not used [-Wunused-but-set-variable]
      622 |     int x = -1, w = 0;
          |                 ^
      compiling kernel/qplatformsessionmanager.cpp
      clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
      ```

      </details>

  * Clang has been bumped to 18 as [bitcoin#30201](bitcoin#30201) drops `native_llvm` (formerly known as `native_clang`) and mandates the presence of Clang 18 or higher for cross-compilation ([source](https://github.com/bitcoin/bitcoin/blob/7cbfd7a7ce45ac68d6041f42f468862f5c193d8c/depends/README.md?plain=1#L54-L57)).

  ## 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
  - [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:
  PastaPastaPasta:
    utACK ee04e1f
  UdjinM6:
    utACK ee04e1f

Tree-SHA512: 0b8be036419a53eda5be77c9abdf214d8f5baa088526f9249daba31e650c50f831f54c389845f828f8b7cf50458967f211a6d42d12b8dae8546b265d7f37a968
  • Loading branch information
PastaPastaPasta committed Jan 7, 2025
2 parents a5787c9 + ee04e1f commit 1c7039f
Show file tree
Hide file tree
Showing 43 changed files with 772 additions and 462 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ libconftest.dylib*

*.log
*.trs
*.dmg
*.zip

*.json.h
*.raw.h
Expand Down
19 changes: 9 additions & 10 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ endif
.PHONY: deploy FORCE
.INTERMEDIATE: $(COVERAGE_INFO)

export PYTHONPATH

if BUILD_BITCOIN_LIBS
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libdashconsensus.pc
Expand All @@ -36,7 +34,7 @@ space := $(empty) $(empty)

OSX_APP=Dash-Qt.app
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
OSX_DMG = $(OSX_VOLNAME).dmg
OSX_ZIP = $(OSX_VOLNAME).zip
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/dash.icns
OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
Expand Down Expand Up @@ -119,23 +117,24 @@ OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lp
$(OSX_APP)/Contents/MacOS/Dash-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings

if BUILD_DARWIN
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -dmg
$(OSX_ZIP): $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -zip

deploydir: $(OSX_DMG)
deploydir: $(OSX_ZIP)
else !BUILD_DARWIN
APP_DIST_DIR=$(top_builddir)/dist

$(OSX_DMG): deploydir
$(XORRISOFS) -D -l -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -o $@ $(APP_DIST_DIR) -- $(if $(SOURCE_DATE_EPOCH),-volume_date all_file_dates =$(SOURCE_DATE_EPOCH))
$(OSX_ZIP): deploydir
if [ -n "$(SOURCE_DATE_EPOCH)" ]; then find $(APP_DIST_DIR) -exec touch -d @$(SOURCE_DATE_EPOCH) {} +; fi
cd $(APP_DIST_DIR) && find . | sort | $(ZIP) -X@ $@

$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
OBJDUMP=$(OBJDUMP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR)

deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt
endif !BUILD_DARWIN

deploy: $(OSX_DMG)
deploy: $(OSX_ZIP)
endif

$(BITCOIN_QT_BIN): FORCE
Expand Down Expand Up @@ -294,7 +293,7 @@ EXTRA_DIST += \
test/util/data/txcreatesignv2.hex \
test/util/rpcauth-test.py

CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
CLEANFILES = $(OSX_ZIP) $(BITCOIN_WIN_INSTALLER)

DISTCHECK_CONFIGURE_FLAGS = --enable-man

Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8

export CONTAINER_NAME=ci_macos_cross
export HOST=x86_64-apple-darwin
export PACKAGES="cmake libz-dev python3-setuptools xorriso"
export PACKAGES="clang cmake lld llvm zip"
export XCODE_VERSION=15.0
export XCODE_BUILD_ID=15A240d
export RUN_UNIT_TESTS=false
Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_native_fuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
export RUN_FUZZ_TESTS=true
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address,undefined,integer --enable-suppress-external-warnings CC=clang-16 CXX=clang++-16 --with-boost-process"
export BITCOIN_CONFIG="--enable-zmq --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address,undefined,integer --enable-suppress-external-warnings CC=clang-18 CXX=clang++-18 --with-boost-process"
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_native_fuzz_with_valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export RUN_FUNCTIONAL_TESTS=false
export RUN_FUZZ_TESTS=true
export FUZZ_TESTS_CONFIG="--valgrind"
export GOAL="install"
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer --enable-suppress-external-warnings CC=clang-16 CXX=clang++-16"
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer --enable-suppress-external-warnings CC=clang-18 CXX=clang++-18"
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_native_multiprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export PACKAGES="cmake python3 llvm clang"
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
export GOAL="install"
export TEST_RUNNER_EXTRA="--v2transport"
export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-16 CXX=clang++-16" # Use clang to avoid OOM
export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-18 CXX=clang++-18" # Use clang to avoid OOM
export BITCOIND=dash-node # Used in functional tests
6 changes: 3 additions & 3 deletions ci/test/00_setup_env_native_tsan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
export LC_ALL=C.UTF-8

export CONTAINER_NAME=ci_native_tsan
export PACKAGES="clang-16 llvm-16 libclang-rt-16-dev libc++abi-16-dev libc++-16-dev python3-zmq"
export DEP_OPTS="CC=clang-16 CXX='clang++-16 -stdlib=libc++'"
export PACKAGES="clang-18 llvm-18 libclang-rt-18-dev libc++abi-18-dev libc++-18-dev python3-zmq"
export DEP_OPTS="CC=clang-18 CXX='clang++-18 -stdlib=libc++'"
export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163)
export TEST_RUNNER_EXTRA="${TEST_RUNNER_EXTRA} --timeout-factor=4" # Increase timeout because sanitizers slow down
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --with-gui=no --with-sanitizers=thread CC=clang-16 CXX=clang++-16 CXXFLAGS='-g' --with-boost-process"
export BITCOIN_CONFIG="--enable-zmq --with-gui=no --with-sanitizers=thread CC=clang-18 CXX=clang++-18 CXXFLAGS='-g' --with-boost-process"
export CPPFLAGS="-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION"
export PYZMQ=true
4 changes: 2 additions & 2 deletions ci/test/00_setup_env_native_ubsan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
export LC_ALL=C.UTF-8

export CONTAINER_NAME=ci_native_ubsan
export PACKAGES="clang-16 llvm-16 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
export PACKAGES="clang-18 llvm-18 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=undefined CC=clang-16 CXX=clang++-16"
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=undefined CC=clang-18 CXX=clang++-18"
export PYZMQ=true
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_native_valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export USE_VALGRIND=1
export NO_DEPENDS=1
export TEST_RUNNER_EXTRA="--exclude rpc_bind --timeout-factor=4" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no --enable-suppress-external-warnings CC=clang-16 CXX=clang++-16" # TODO enable GUI
export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no --enable-suppress-external-warnings CC=clang-18 CXX=clang++-18" # TODO enable GUI
6 changes: 2 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ AC_PATH_TOOL(DSYMUTIL, dsymutil)
AC_PATH_PROG(DOXYGEN, doxygen)
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])

AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files)

AC_ARG_ENABLE([wallet],
[AS_HELP_STRING([--disable-wallet],
[disable wallet (enabled by default)])],
Expand Down Expand Up @@ -843,7 +841,7 @@ case $host in
;;
*)
AC_PATH_TOOL([DSYMUTIL], [dsymutil], dsymutil)
AC_PATH_PROGS([XORRISOFS], [xorrisofs], xorrisofs)
AC_PATH_PROG([ZIP], [zip], [zip])

dnl libtool will try to strip the static lib, which is a problem for
dnl cross-builds because strip attempts to call a hard-coded ld,
Expand Down Expand Up @@ -1934,7 +1932,6 @@ AC_CONFIG_LINKS([contrib/devtools/test-security-check.py:contrib/devtools/test-s
AC_CONFIG_LINKS([contrib/devtools/symbol-check.py:contrib/devtools/symbol-check.py])
AC_CONFIG_LINKS([contrib/devtools/test-symbol-check.py:contrib/devtools/test-symbol-check.py])
AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
AC_CONFIG_LINKS([contrib/macdeploy/background.tiff:contrib/macdeploy/background.tiff])
AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])
AC_CONFIG_LINKS([test/fuzz/test_runner.py:test/fuzz/test_runner.py])
AC_CONFIG_LINKS([test/util/test_runner.py:test/util/test_runner.py])
Expand Down Expand Up @@ -2014,5 +2011,6 @@ echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS
echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $CORE_LDFLAGS $LDFLAGS"
echo " AR = $AR"
echo " ARFLAGS = $ARFLAGS"
echo
14 changes: 9 additions & 5 deletions contrib/containers/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,27 @@ RUN set -ex; \
# Install Clang+LLVM and set it as default
# We don't need all packages but the default set doesn't include some
# packages we want so we will need to install some of them manually.
ARG LLVM_VERSION=16
ARG LLVM_VERSION=18
RUN set -ex; \
echo "Installing LLVM and Clang ${LLVM_VERSION}..."; \
curl -sL https://apt.llvm.org/llvm.sh | bash -s "${LLVM_VERSION}"; \
curl -sL https://apt.llvm.org/llvm.sh | bash -s -- "${LLVM_VERSION}"; \
echo "Installing additional packages..."; \
apt-get update && apt-get install $APT_ARGS \
"clang-format-${LLVM_VERSION}" \
"clang-tidy-${LLVM_VERSION}" \
"libc++-${LLVM_VERSION}-dev" \
"libc++abi-${LLVM_VERSION}-dev" \
"libclang-rt-${LLVM_VERSION}-dev"; \
"libclang-rt-${LLVM_VERSION}-dev" \
"lld-${LLVM_VERSION}"; \
rm -rf /var/lib/apt/lists/*; \
echo "Setting defaults..."; \
lldbUpdAltArgs="update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${LLVM_VERSION} 100"; \
for binName in clang clang++ clang-format clang-tidy clangd ld.lld lldb lldb-server; do \
for binName in clang clang++ clang-format clang-tidy clangd dsymutil lld lldb lldb-server llvm-ar llvm-cov llvm-nm llvm-objdump llvm-ranlib llvm-strip; do \
lldbUpdAltArgs="${lldbUpdAltArgs} --slave /usr/bin/${binName} ${binName} /usr/bin/${binName}-${LLVM_VERSION}"; \
done; \
for binName in ld64.lld ld.lld lld-link wasm-ld; do \
lldbUpdAltArgs="${lldbUpdAltArgs} --slave /usr/bin/${binName} ${binName} /usr/bin/lld-${LLVM_VERSION}"; \
done; \
sh -c "${lldbUpdAltArgs}";
# LD_LIBRARY_PATH is empty by default, this is the first entry
ENV LD_LIBRARY_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib"
Expand Down Expand Up @@ -159,7 +163,7 @@ RUN apt-get update && apt-get install $APT_ARGS \
valgrind \
wine-stable \
wine64 \
xorriso \
zip \
&& rm -rf /var/lib/apt/lists/*

# This is a hack. It is needed because gcc-multilib and g++-multilib are conflicting with g++-arm-linux-gnueabihf. This is
Expand Down
6 changes: 3 additions & 3 deletions contrib/devtools/symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ def check_MACHO_sdk(binary) -> bool:
return True
return False

def check_MACHO_ld64(binary) -> bool:
if binary.build_version.tools[0].version == [711, 0, 0]:
def check_MACHO_lld(binary) -> bool:
if binary.build_version.tools[0].version == [18, 1, 6]:
return True
return False

Expand Down Expand Up @@ -295,7 +295,7 @@ def check_ELF_ABI(binary) -> bool:
('DYNAMIC_LIBRARIES', check_MACHO_libraries),
('MIN_OS', check_MACHO_min_os),
('SDK', check_MACHO_sdk),
('LD64', check_MACHO_ld64),
('LLD', check_MACHO_lld),
],
lief.EXE_FORMATS.PE: [
('DYNAMIC_LIBRARIES', check_PE_libraries),
Expand Down
24 changes: 9 additions & 15 deletions contrib/devtools/test-security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,15 @@ def test_MACHO(self):
arch = get_arch(cc, source, executable)

if arch == lief.ARCHITECTURES.X86:
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector', '-Wl,-no_fixup_chains']),
(1, executable+': failed NOUNDEFS Canary FIXUP_CHAINS PIE NX CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector', '-Wl,-fixup_chains']),
(1, executable+': failed NOUNDEFS Canary PIE NX CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed NOUNDEFS PIE NX CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed NOUNDEFS PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
(1, executable+': failed PIE'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-pie','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fno-stack-protector', '-Wl,-no_fixup_chains']),
(1, executable+': failed NOUNDEFS Canary FIXUP_CHAINS PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fno-stack-protector', '-Wl,-fixup_chains']),
(1, executable+': failed NOUNDEFS Canary CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed NOUNDEFS CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
(0, ''))
else:
# arm64 darwin doesn't support non-PIE binaries, control flow or executable stacks
Expand Down
28 changes: 3 additions & 25 deletions contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,7 @@ for p in "${PATHS[@]}"; do
done

# Disable Guix ld auto-rpath behavior
case "$HOST" in
*darwin*)
# The auto-rpath behavior is necessary for darwin builds as some native
# tools built by depends refer to and depend on Guix-built native
# libraries
#
# After the native packages in depends are built, the ld wrapper should
# no longer affect our build, as clang would instead reach for
# x86_64-apple-darwin-ld from cctools
;;
*) export GUIX_LD_WRAPPER_DISABLE_RPATH=yes ;;
esac
export GUIX_LD_WRAPPER_DISABLE_RPATH=yes

# Make /usr/bin if it doesn't exist
[ -e /usr/bin ] || mkdir -p /usr/bin
Expand Down Expand Up @@ -175,16 +164,6 @@ esac
# Environment variables for determinism
export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name"
export TZ="UTC"
case "$HOST" in
*darwin*)
# cctools AR, unlike GNU binutils AR, does not have a deterministic mode
# or a configure flag to enable determinism by default, it only
# understands if this env-var is set or not. See:
#
# https://github.com/tpoechtrager/cctools-port/blob/55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/ar/archive.c#L334
export ZERO_AR_DATE=yes
;;
esac

####################
# Depends Building #
Expand All @@ -201,8 +180,7 @@ make -C depends --jobs="$JOBS" HOST="$HOST" \
x86_64_linux_AR=x86_64-linux-gnu-gcc-ar \
x86_64_linux_RANLIB=x86_64-linux-gnu-gcc-ranlib \
x86_64_linux_NM=x86_64-linux-gnu-gcc-nm \
x86_64_linux_STRIP=x86_64-linux-gnu-strip \
FORCE_USE_SYSTEM_CLANG=1
x86_64_linux_STRIP=x86_64-linux-gnu-strip


###########################
Expand Down Expand Up @@ -326,7 +304,7 @@ mkdir -p "$DISTSRC"
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
)
make deploy ${V:+V=1} OSX_DMG="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.dmg"
make deploy ${V:+V=1} OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
;;
esac
(
Expand Down
11 changes: 6 additions & 5 deletions contrib/guix/libexec/codesign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ mkdir -p "$DISTSRC"
# Apply detached codesignatures to dist/ (in-place)
signapple apply dist/Dash-Qt.app codesignatures/osx/dist

# Make a DMG from dist/
xorrisofs -D -l -V "$(< osx_volname)" -no-pad -r -dir-mode 0755 \
-o "${OUTDIR}/${DISTNAME}-${HOST}.dmg" \
dist \
-- -volume_date all_file_dates ="$SOURCE_DATE_EPOCH"
# Make a .zip from dist/
cd dist/
find . -print0 \
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
find . | sort \
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip"
;;
*)
exit 1
Expand Down
19 changes: 7 additions & 12 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
((gnu packages bash) #:select (bash-minimal))
(gnu packages bison)
((gnu packages certs) #:select (nss-certs))
((gnu packages cdrom) #:select (xorriso))
((gnu packages cmake) #:select (cmake-minimal))
(gnu packages commencement)
(gnu packages compression)
Expand Down Expand Up @@ -578,6 +577,7 @@ inspecting signatures in Mach-O binaries.")
gzip
xz
;; Build tools
gcc-toolchain-12
cmake-minimal
gnu-make
libtool
Expand All @@ -593,23 +593,18 @@ inspecting signatures in Mach-O binaries.")
python-lief)
(let ((target (getenv "HOST")))
(cond ((string-suffix? "-mingw32" target)
(list ;; Native GCC 12 toolchain
gcc-toolchain-12
zip
(list zip
(make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32")
nsis-x86_64
nss-certs
osslsigncode))
((string-contains target "-linux-")
(list ;; Native GCC 12 toolchain
gcc-toolchain-12
(list gcc-toolchain-12 "static")
(list (list gcc-toolchain-12 "static")
(make-bitcoin-cross-toolchain target)))
((string-contains target "darwin")
(list ;; Native GCC 11 toolchain
gcc-toolchain-11
binutils
clang-toolchain-17
(list clang-toolchain-18
lld-18
(make-lld-wrapper lld-18 #:lld-as-ld? #t)
python-signapple
xorriso))
zip))
(else '())))))
Loading

0 comments on commit 1c7039f

Please sign in to comment.