Files
dragonx/util/build-win.sh
DanS d12e7dc99d Merge origin/master into dev: restore the mingw -Wa,-mbig-obj flag
dev branched from the release line before 1c3523aac and so lost -Wa,-mbig-obj
from util/build-win.sh. Without it the Windows cross-compile fails at link: large
template/boost-heavy translation units exceed the PE/COFF ~32k-section limit, and
GNU ld emits "dangerous relocation" on .pdata and crashes. v1.1.0 therefore could
not produce a win64 binary at all.

The merge brings only that one file back. util/build-win.sh is the only file both
sides touched, and the two edits are ~20 lines apart, so it auto-merges keeping
both fixes: -Wa,-mbig-obj on the configure line and -DARCH=default on the cmake
line. Verified after merging that dev's own work is intact -- the extended
checkpoint table, the guarded RandomX dedup, the 1.1.0 version bump, and
ARCH=default in the other two build scripts.

No C++ changed; the only delta from the pre-merge dev is the shell script.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 10:42:29 -05:00

53 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2016-2024 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
export HOST=x86_64-w64-mingw32
CXX=x86_64-w64-mingw32-g++-posix
CC=x86_64-w64-mingw32-gcc-posix
PREFIX="$(pwd)/depends/$HOST"
set -eu -o pipefail
set -x
cd "$(dirname "$(readlink -f "$0")")/.."
cd depends/ && make HOST=$HOST V=1 NO_QT=1
cd ..
./autogen.sh
# -Wa,-mbig-obj: the daemon's large template/boost-heavy TUs (e.g. asyncrpcoperation.cpp) exceed the
# standard PE/COFF ~32k-section limit, which makes GNU ld emit "dangerous relocation" on .pdata and
# crash. The bigobj COFF variant lifts that limit (same flag Bitcoin Core sets for the mingw host).
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -fopenmp -pthread -Wa,-mbig-obj" ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared
# Build CryptoConditions stuff
WD=$PWD
cd src/cc
echo $PWD
./makecustom
cd $WD
# Build RandomX
cd src/RandomX
if [ -d "build" ]
then
ls -la build/librandomx*
else
mkdir build && cd build
# ARCH=default, NOT native. RandomX's CMakeLists maps ARCH=native to -march=native, which
# tunes the binary to the BUILD machine. Measured 2026-08-21: a build on the Zen4 pool box
# emitted 746 AVX-512 (zmm) instructions into librandomx.a, and every seed reports
# avx512f=no -- that binary SIGILLs inside RandomX on the whole fleet, and on any user CPU
# older than the build host. ARCH=default still enables -maes plus per-file -mssse3/-mavx2
# for argon2, so the portable baseline costs ~nothing.
CC="${CC} -g " CXX="${CXX} -g " cmake -DARCH=default ..
make
fi
cd $WD
sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure
cd src/
CC="${CC} -g " CXX="${CXX} -g " make V=1 dragonxd.exe dragonx-cli.exe dragonx-tx.exe