From 09906a741aba1cb7ab1cf4a28a8fb9564077c3f3 Mon Sep 17 00:00:00 2001 From: Rhett Creighton <2388024+RhettCreighton@users.noreply.github.com> Date: Mon, 16 Mar 2026 06:45:33 -0400 Subject: [PATCH] Fix build for GCC 15 and add Arch Linux/Manjaro support GCC 15 defaults to C23 semantics where void f() means no parameters, breaking GMP 6.3.0 configure tests. Add -std=gnu17/-std=gnu++17 to depends CFLAGS/CXXFLAGS to restore compatibility. Fix FakeCoinsViewDB::DB_COINS ODR violation that causes link failure with GCC 15 by copying the static member to a local variable before passing to std::make_pair. Pass explicit --with-boost, CPPFLAGS, and LDFLAGS in build.sh to fix unreliable depends_prefix resolution in config.site with newer autoconf. Add Arch/Manjaro/EndeavourOS/Garuda support to install-deps.sh. Update BUILD.md with Arch Linux instructions. --- BUILD.md | 19 ++++++++++++++++--- depends/hosts/linux.mk | 4 ++-- src/zcbenchmarks.cpp | 8 +++++--- zcutil/build.sh | 11 ++++++++++- zcutil/install-deps.sh | 37 +++++++++++++++++++++++++++++++++++-- 5 files changed, 68 insertions(+), 11 deletions(-) diff --git a/BUILD.md b/BUILD.md index da78508476a..3aab11c7a5c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -4,7 +4,7 @@ This guide will help you build `zclassicd` (ZClassic daemon) from source code. ## System Requirements -- **Operating System**: Ubuntu 20.04+, Debian 11+, or compatible Linux distribution +- **Operating System**: Ubuntu 20.04+, Debian 11+, Arch Linux, Manjaro, or compatible Linux distribution - **Memory**: At least 4 GB RAM recommended - **Disk Space**: 20 GB free space (for build files and blockchain data) - **Compiler**: GCC 9+ or Clang 10+ @@ -42,6 +42,15 @@ sudo apt-get install -y \ zlib1g-dev libssl-dev libevent-dev ``` +#### Arch Linux / Manjaro + +```bash +sudo pacman -S --needed \ + base-devel autoconf automake libtool pkgconf \ + gmp db libsodium curl \ + git python wget openssl libevent +``` + #### Other Distributions Install equivalent packages for your distribution. The key dependencies are: @@ -139,11 +148,15 @@ If Arweave downloads fail during first run: ```bash # Build only the dependencies -make -C depends -j$(nproc) +make -C depends -j$(nproc) NO_PROTON=1 # Then configure with the dependencies ./autogen.sh -CONFIG_SITE=$PWD/depends/x86_64-unknown-linux-gnu/share/config.site ./configure +DEPS_DIR=$PWD/depends/x86_64-unknown-linux-gnu +CONFIG_SITE=$DEPS_DIR/share/config.site ./configure \ + --with-boost=$DEPS_DIR \ + CPPFLAGS="-I$DEPS_DIR/include" \ + LDFLAGS="-L$DEPS_DIR/lib" make -j$(nproc) ``` diff --git a/depends/hosts/linux.mk b/depends/hosts/linux.mk index 31748d66226..adbe87252fa 100644 --- a/depends/hosts/linux.mk +++ b/depends/hosts/linux.mk @@ -1,5 +1,5 @@ -linux_CFLAGS=-pipe -linux_CXXFLAGS=$(linux_CFLAGS) +linux_CFLAGS=-pipe -std=gnu17 +linux_CXXFLAGS=-pipe -std=gnu++17 linux_release_CFLAGS=-O1 linux_release_CXXFLAGS=$(linux_release_CFLAGS) diff --git a/src/zcbenchmarks.cpp b/src/zcbenchmarks.cpp index b9f0cc68020..d8c22a2d068 100644 --- a/src/zcbenchmarks.cpp +++ b/src/zcbenchmarks.cpp @@ -456,7 +456,7 @@ double benchmark_increment_sapling_note_witnesses(size_t nTxs) // CCoinsViewDB, but the rest are either mocks and/or don't really do anything. class FakeCoinsViewDB : public CCoinsView { // The following constant is a duplicate of the one found in txdb.cpp - static const char DB_COINS = 'c'; + static constexpr char DB_COINS = 'c'; CDBWrapper db; @@ -488,11 +488,13 @@ class FakeCoinsViewDB : public CCoinsView { } bool GetCoins(const uint256 &txid, CCoins &coins) const { - return db.Read(std::make_pair(DB_COINS, txid), coins); + char key = DB_COINS; + return db.Read(std::make_pair(key, txid), coins); } bool HaveCoins(const uint256 &txid) const { - return db.Exists(std::make_pair(DB_COINS, txid)); + char key = DB_COINS; + return db.Exists(std::make_pair(key, txid)); } uint256 GetBestBlock() const { diff --git a/zcutil/build.sh b/zcutil/build.sh index 581bf982d07..c23e9df9a51 100755 --- a/zcutil/build.sh +++ b/zcutil/build.sh @@ -103,5 +103,14 @@ ld -v HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1 ./autogen.sh -CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" $CONFIGURE_FLAGS CXXFLAGS='-g' + +DEPS_DIR="$PWD/depends/$HOST" +CONFIG_SITE="$DEPS_DIR/share/config.site" ./configure \ + "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" \ + --with-boost="$DEPS_DIR" \ + $CONFIGURE_FLAGS \ + CXXFLAGS='-g' \ + CPPFLAGS="-I$DEPS_DIR/include" \ + LDFLAGS="-L$DEPS_DIR/lib" + "$MAKE" "$@" V=1 diff --git a/zcutil/install-deps.sh b/zcutil/install-deps.sh index 13b986b8f35..2d1bfeffabf 100755 --- a/zcutil/install-deps.sh +++ b/zcutil/install-deps.sh @@ -14,7 +14,7 @@ if [ -f /etc/os-release ]; then . /etc/os-release OS=$ID else - echo "Cannot detect OS. This script supports Ubuntu/Debian." + echo "Cannot detect OS. This script supports Ubuntu/Debian and Arch-based distributions." exit 1 fi @@ -79,13 +79,46 @@ install_ubuntu_debian() { echo "✓ All dependencies installed successfully!" } +install_arch() { + echo "Installing dependencies for Arch/Manjaro..." + echo "" + + PACKAGES=( + base-devel + autoconf + automake + libtool + pkgconf + gmp + db + libsodium + curl + git + python + wget + openssl + libevent + ) + + echo "Installing packages: ${PACKAGES[*]}" + echo "" + + $SUDO pacman -S --needed --noconfirm "${PACKAGES[@]}" + + echo "" + echo "All dependencies installed successfully!" +} + case "$OS" in ubuntu|debian|linuxmint|pop) install_ubuntu_debian ;; + arch|manjaro|endeavouros|garuda) + install_arch + ;; *) echo "Unsupported OS: $OS" - echo "This script currently supports Ubuntu and Debian-based distributions." + echo "This script supports Ubuntu/Debian and Arch-based distributions." echo "" echo "Required packages:" echo " - build-essential, autoconf, libtool, automake"