0.3.6 on both PCs: igneumd.exe (built on PC 1 with GCC 13's mingw) shipped with the Mac toolchain's GCC 16 libstdc++-6.dll, which no longer exports seven symbols the exe imports (std::codecvt_utf8_utf16 and a stringbuf::seekpos); Windows refused the node with Entry Point Not Found. -C link-arg=-static had never removed the libstdc++ import (0.3.5's Mac-built exe carries it too). - packaging/windows/check-runtime-dlls.sh: objdump imports per DLL against the DLL's exports; shown to fail the 0.3.6 pairing (7 missing) and pass 0.3.5's; run by push-inputs.sh before signing and by make-payload.sh - push-inputs.sh: DLLs next to the exes first, then the Mac toolchain - jobbuild.rs: the PC's windows stage copies its own toolchain's three DLLs into the pack (unit test); build-job.mjs accepts the small DLL PE files and places them next to the exes - cross-build.sh: -static-libstdc++ added as a try (measured on the 0.3.7 build) - the six version files: 0.3.7
40 lines
3.1 KiB
Bash
Executable file
40 lines
3.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Cross-compiles igneumd.exe and igneum-miner.exe for x86_64-pc-windows-gnu on the Mac (Homebrew mingw-w64 and llvm).
|
|
# Worked on 3 October 2026 (8 min 25 s with -j 6 at nice 19 on a loaded M5 Max); see WINDOWS-MINER.md, "Run your own node".
|
|
# What each variable is for:
|
|
# CC/CXX/AR_x86_64_pc_windows_gnu the cc crate builds rocksdb (C++), snappy, zstd, lz4, bzip2, zlib, secp256k1 and
|
|
# mimalloc with the mingw compilers
|
|
# LIBCLANG_PATH librocksdb-sys runs bindgen on rocksdb/c.h; Homebrew llvm's libclang
|
|
# BINDGEN_EXTRA_CLANG_ARGS_... bindgen's clang must parse the mingw headers for the Windows target, not the Mac's
|
|
# CARGO_TARGET_..._RUSTFLAGS -static: ld takes libstdc++.a, libgcc.a and libwinpthread.a instead of the import
|
|
# libraries, so the exe does not need libstdc++-6.dll, libgcc_s_seh-1.dll or
|
|
# libwinpthread-1.dll on the PC (the first build linked libstdc++-6.dll because
|
|
# -static-libstdc++ means nothing to the gcc driver rustc links with)
|
|
# Usage: windows-node/cross-build.sh [node worktree, default vendor/igneum-node-win] [cargo jobs, default 6]
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
ROOT="$(cd "$HERE/../.." && pwd)"
|
|
NODE="${1:-$ROOT/vendor/igneum-node-win}"
|
|
JOBS="${2:-6}"
|
|
MINGW="/opt/homebrew/opt/mingw-w64/toolchain-x86_64/x86_64-w64-mingw32"
|
|
[ -d "$MINGW" ] || { echo "no mingw-w64 at $MINGW (brew install mingw-w64)" >&2; exit 1; }
|
|
[ -f /opt/homebrew/opt/llvm/lib/libclang.dylib ] || { echo "no libclang at /opt/homebrew/opt/llvm/lib (brew install llvm)" >&2; exit 1; }
|
|
export PATH="$HOME/.cargo/bin:/opt/homebrew/bin:$PATH"
|
|
rustup target list --installed | grep -q x86_64-pc-windows-gnu || rustup target add x86_64-pc-windows-gnu
|
|
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-target}"
|
|
export CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc
|
|
export CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++
|
|
export AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-ar
|
|
export LIBCLANG_PATH=/opt/homebrew/opt/llvm/lib
|
|
export BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_windows_gnu="--target=x86_64-w64-mingw32 --sysroot=$MINGW -I$MINGW/include"
|
|
# 5 October 2026 (0.3.7): -static-libstdc++ added as a try; -static alone left libstdc++-6.dll in the import table of
|
|
# every exe so far (0.3.5's and the PC's), which is why the payload must ship the DLLs of the toolchain that linked
|
|
# the exes (push-inputs.sh takes them from next to the exes first, then from this toolchain) and why push-inputs.sh
|
|
# refuses an exe that imports a symbol the shipped DLL does not export.
|
|
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="-C link-arg=-static -C link-arg=-static-libgcc -C link-arg=-static-libstdc++"
|
|
cd "$NODE"
|
|
nice -n 19 cargo build --release -j "$JOBS" -p kaspad -p igneum-miner --features igneum-pow --target x86_64-pc-windows-gnu
|
|
for exe in igneumd igneum-miner; do
|
|
f="$CARGO_TARGET_DIR/x86_64-pc-windows-gnu/release/$exe.exe"
|
|
echo "$f: $(stat -f %z "$f") bytes; DLLs: $(x86_64-w64-mingw32-objdump -p "$f" | grep 'DLL Name' | awk '{print $3}' | sort -u | tr '\n' ' ')"
|
|
done
|