Fix macOS Sequoia build with GCC 15 and update README
- Update compiler references from gcc-8 to gcc-15 across build system (build-mac.sh, darwin.mk, Makefile_custom) - Use system Rust (rustup) instead of bundled Rust 1.32.0 for librustzcash to fix rlib linker incompatibility on macOS Sequoia - Replace deprecated std::random_shuffle with std::shuffle (net.cpp, transaction_builder.cpp, wallet.cpp) - Fix -std=gnu17 -> -std=gnu++17 for C++ targets (libzcash, libhush) - Fix nodiscard warning in glibcxx_sanity.cpp - Replace deprecated OSMemoryBarrier with std::atomic_thread_fence in LevelDB - Add -Wno-error=deprecated-declarations to CXXFLAGS for third-party headers - Fix REMAINING_ARGS unbound variable in build.sh - Add --disable-tests handling to build-mac.sh - Update README with correct macOS build dependencies and instructions
This commit is contained in:
25
README.md
25
README.md
@@ -106,19 +106,32 @@ apt-get install -y gcc-7 g++-7 && \
|
||||
|
||||
# Build on Mac
|
||||
|
||||
```
|
||||
sudo port update
|
||||
sudo port upgrade outdated
|
||||
sudo port install qt5
|
||||
Install Xcode Command Line Tools and [Homebrew](https://brew.sh/), then install dependencies:
|
||||
|
||||
```sh
|
||||
xcode-select --install
|
||||
brew install gcc autoconf automake pkgconf libtool cmake curl
|
||||
|
||||
# Install Rust (needed for librustzcash on macOS Sequoia+)
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
source "$HOME/.cargo/env"
|
||||
|
||||
# clone git repo
|
||||
git clone https://git.hush.is/hush/hush3
|
||||
cd hush3
|
||||
# Build
|
||||
# This uses 3 build processes, you need 2GB of RAM for each.
|
||||
# Build (uses 3 build processes, you need 2GB of RAM for each)
|
||||
# Make sure libtool gnubin and cargo are on PATH
|
||||
export PATH="$HOME/.cargo/bin:/usr/local/opt/libtool/libexec/gnubin:$PATH"
|
||||
./build.sh -j3
|
||||
```
|
||||
|
||||
For a release build:
|
||||
|
||||
```sh
|
||||
export PATH="$HOME/.cargo/bin:/usr/local/opt/libtool/libexec/gnubin:$PATH"
|
||||
./build.sh --mac-release -j$(sysctl -n hw.ncpu)
|
||||
```
|
||||
|
||||
# Installing Hush binaries
|
||||
|
||||
1. [Download the release](https://git.hush.is/hush/hush3/releases) with a .deb file extension.
|
||||
|
||||
12
build.sh
12
build.sh
@@ -175,21 +175,21 @@ if [ $BUILD_LINUX_COMPAT -eq 1 ] || [ $BUILD_LINUX_RELEASE -eq 1 ] || [ $BUILD_W
|
||||
if [ $BUILD_LINUX_RELEASE -eq 1 ]; then
|
||||
echo "=== Building Linux release ==="
|
||||
clean_for_platform linux
|
||||
./util/build.sh --disable-tests "${REMAINING_ARGS[@]}"
|
||||
./util/build.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"}
|
||||
package_release linux-amd64
|
||||
fi
|
||||
|
||||
if [ $BUILD_WIN_RELEASE -eq 1 ]; then
|
||||
echo "=== Building Windows release ==="
|
||||
clean_for_platform windows
|
||||
./util/build-win.sh --disable-tests "${REMAINING_ARGS[@]}"
|
||||
./util/build-win.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"}
|
||||
package_release win64
|
||||
fi
|
||||
|
||||
if [ $BUILD_MAC_RELEASE -eq 1 ]; then
|
||||
echo "=== Building macOS release ==="
|
||||
clean_for_platform macos
|
||||
./util/build-mac.sh --disable-tests "${REMAINING_ARGS[@]}"
|
||||
./util/build-mac.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"}
|
||||
package_release macos
|
||||
fi
|
||||
|
||||
@@ -201,11 +201,11 @@ fi
|
||||
|
||||
# Standard build (auto-detect OS)
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
./util/build.sh --disable-tests "${REMAINING_ARGS[@]}"
|
||||
./util/build.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"}
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
./util/build-mac.sh --disable-tests "${REMAINING_ARGS[@]}"
|
||||
./util/build-mac.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"}
|
||||
elif [[ "$OSTYPE" == "msys"* ]]; then
|
||||
./util/build-win.sh --disable-tests "${REMAINING_ARGS[@]}"
|
||||
./util/build-win.sh --disable-tests ${REMAINING_ARGS[@]+"${REMAINING_ARGS[@]}"}
|
||||
else
|
||||
echo "Unable to detect your OS. What are you using?"
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
build_darwin_CC = gcc-8
|
||||
build_darwin_CXX = g++-8
|
||||
build_darwin_CC = gcc-15
|
||||
build_darwin_CXX = g++-15
|
||||
build_darwin_AR: = $(shell xcrun -f ar)
|
||||
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
|
||||
build_darwin_STRIP: = $(shell xcrun -f strip)
|
||||
@@ -10,8 +10,8 @@ build_darwin_SHA256SUM = shasum -a 256
|
||||
build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o
|
||||
|
||||
#darwin host on darwin builder. overrides darwin host preferences.
|
||||
darwin_CC= gcc-8
|
||||
darwin_CXX= g++-8
|
||||
darwin_CC= gcc-15
|
||||
darwin_CXX= g++-15
|
||||
darwin_AR:=$(shell xcrun -f ar)
|
||||
darwin_RANLIB:=$(shell xcrun -f ranlib)
|
||||
darwin_STRIP:=$(shell xcrun -f strip)
|
||||
|
||||
@@ -2,8 +2,8 @@ OSX_MIN_VERSION=10.12
|
||||
OSX_SDK_VERSION=10.12
|
||||
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
|
||||
LD64_VERSION=253.9
|
||||
darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||
darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||
darwin_CC=gcc-15 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||
darwin_CXX=g++-15 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||
|
||||
darwin_CFLAGS=-pipe
|
||||
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||
|
||||
@@ -41,7 +41,7 @@ define $(package)_preprocess_cmds
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts)
|
||||
CARGO=$(HOME)/.cargo/bin/cargo RUSTC=$(HOME)/.cargo/bin/rustc $(HOME)/.cargo/bin/cargo build --package librustzcash $($(package)_build_opts)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
|
||||
8
depends/strip-rlib-metadata.sh
Executable file
8
depends/strip-rlib-metadata.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Strip rust.metadata.bin from .rlib archives for macOS linker compatibility
|
||||
RLIB_DIR="$1"
|
||||
if [ -d "$RLIB_DIR" ]; then
|
||||
for rlib in "$RLIB_DIR"/*.rlib; do
|
||||
[ -f "$rlib" ] && ar d "$rlib" rust.metadata.bin 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
@@ -594,7 +594,7 @@ libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBOOST_SPIRIT_THREADSAFE -DHAV
|
||||
#libzcash_a_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
#libzcash_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMONTGOMERY_OUTPUT
|
||||
|
||||
libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu17
|
||||
libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu++17
|
||||
libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
|
||||
libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
|
||||
|
||||
@@ -636,7 +636,7 @@ libhush_a_SOURCES = \
|
||||
|
||||
libhush_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) -pipe -O1 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
|
||||
|
||||
libhush_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu17
|
||||
libhush_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing -std=gnu++17
|
||||
|
||||
libhush_a_LDFLAGS = $(HARDENED_LDFLAGS)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
SHELL = /bin/sh
|
||||
CC_DARWIN = g++-8
|
||||
CC_DARWIN = g++-15
|
||||
CC_WIN = x86_64-w64-mingw32-gcc-posix
|
||||
CC_AARCH64 = aarch64-linux-gnu-g++
|
||||
CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
|
||||
|
||||
BIN
src/cc/customcc.dylib
Normal file
BIN
src/cc/customcc.dylib
Normal file
Binary file not shown.
@@ -47,7 +47,7 @@ bool sanity_test_range_fmt()
|
||||
{
|
||||
std::string test;
|
||||
try {
|
||||
test.at(1);
|
||||
(void)test.at(1);
|
||||
} catch (const std::out_of_range&) {
|
||||
return true;
|
||||
} catch (...) {
|
||||
|
||||
@@ -51,8 +51,9 @@ namespace port {
|
||||
|
||||
// Mac OS
|
||||
#elif defined(OS_MACOSX)
|
||||
#include <atomic>
|
||||
inline void MemoryBarrier() {
|
||||
OSMemoryBarrier();
|
||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||
}
|
||||
#define LEVELDB_HAVE_MEMORY_BARRIER
|
||||
|
||||
|
||||
BIN
src/libcc.dylib
Normal file
BIN
src/libcc.dylib
Normal file
Binary file not shown.
@@ -33,6 +33,8 @@
|
||||
#include "crypto/common.h"
|
||||
#include "hush/utiltls.h"
|
||||
#include <random.h>
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#ifdef _WIN32
|
||||
#include <string.h>
|
||||
#else
|
||||
@@ -2004,7 +2006,7 @@ void ThreadMessageHandler()
|
||||
// Randomize the order in which we process messages from/to our peers.
|
||||
// This prevents attacks in which an attacker exploits having multiple
|
||||
// consecutive connections in the vNodes list.
|
||||
random_shuffle(vNodesCopy.begin(), vNodesCopy.end(), GetRandInt);
|
||||
std::shuffle(vNodesCopy.begin(), vNodesCopy.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max())));
|
||||
|
||||
BOOST_FOREACH(CNode* pnode, vNodesCopy)
|
||||
{
|
||||
@@ -2516,7 +2518,7 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
|
||||
// We always round down, except when we have only 1 connection
|
||||
auto newSize = (vNodes.size() / 2) == 0 ? 1 : (vNodes.size() / 2);
|
||||
|
||||
random_shuffle( vRelayNodes.begin(), vRelayNodes.end(), GetRandInt );
|
||||
std::shuffle( vRelayNodes.begin(), vRelayNodes.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max())) );
|
||||
|
||||
vRelayNodes.resize(newSize);
|
||||
if (HUSH_TESTNODE==1 && vNodes.size() == 0) {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
#include <librustzcash.h>
|
||||
#include "zcash/Note.hpp"
|
||||
#include <random>
|
||||
#include <limits>
|
||||
extern bool fZDebug;
|
||||
|
||||
SpendDescriptionInfo::SpendDescriptionInfo(
|
||||
@@ -66,7 +68,7 @@ void TransactionBuilder::AddSaplingOutput(
|
||||
void TransactionBuilder::ShuffleOutputs()
|
||||
{
|
||||
LogPrintf("%s: Shuffling %d zouts\n", __func__, outputs.size() );
|
||||
random_shuffle( outputs.begin(), outputs.end(), GetRandInt );
|
||||
std::shuffle( outputs.begin(), outputs.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max())) );
|
||||
}
|
||||
|
||||
void TransactionBuilder::AddTransparentInput(COutPoint utxo, CScript scriptPubKey, CAmount value, uint32_t _nSequence)
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "coins.h"
|
||||
#include "wallet/asyncrpcoperation_saplingconsolidation.h"
|
||||
#include "wallet/asyncrpcoperation_sweep.h"
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include "zcash/zip32.h"
|
||||
#include "cc/CCinclude.h"
|
||||
#include <assert.h>
|
||||
@@ -3416,7 +3418,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
vector<pair<CAmount, pair<const CWalletTx*,unsigned int> > > vValue;
|
||||
CAmount nTotalLower = 0;
|
||||
|
||||
random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt);
|
||||
std::shuffle(vCoins.begin(), vCoins.end(), std::mt19937(GetRand(std::numeric_limits<uint32_t>::max())));
|
||||
|
||||
BOOST_FOREACH(const COutput &output, vCoins)
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
export CC=gcc-8
|
||||
export CXX=g++-8
|
||||
export CC=gcc-15
|
||||
export CXX=g++-15
|
||||
export LIBTOOL=libtool
|
||||
export AR=ar
|
||||
export RANLIB=ranlib
|
||||
@@ -34,16 +34,24 @@ fi
|
||||
# If --enable-lcov is the first argument, enable lcov coverage support:
|
||||
LCOV_ARG=''
|
||||
HARDENING_ARG='--disable-hardening'
|
||||
TEST_ARG=''
|
||||
if [ "x${1:-}" = 'x--enable-lcov' ]
|
||||
then
|
||||
LCOV_ARG='--enable-lcov'
|
||||
HARDENING_ARG='--disable-hardening'
|
||||
shift
|
||||
elif [ "x${1:-}" = 'x--disable-tests' ]
|
||||
then
|
||||
TEST_ARG='--enable-tests=no'
|
||||
shift
|
||||
fi
|
||||
|
||||
TRIPLET=`./depends/config.guess`
|
||||
PREFIX="$(pwd)/depends/$TRIPLET"
|
||||
|
||||
# Ensure system Rust is in PATH for modern macOS compatibility
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
make "$@" -C ./depends/ V=1 NO_QT=1
|
||||
|
||||
#BUILD CCLIB
|
||||
@@ -68,7 +76,7 @@ cd $WD
|
||||
|
||||
./autogen.sh
|
||||
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
|
||||
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
|
||||
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
|
||||
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc/15.2.0_1/include/c++/15/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -Wno-error=deprecated-declarations -g -Wl,-undefined -Wl,dynamic_lookup' \
|
||||
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" $TEST_ARG
|
||||
|
||||
make "$@" V=1 NO_GTEST=1 STATIC=1
|
||||
|
||||
Reference in New Issue
Block a user