From bcf3973d3e9af44c50dd8f25f5d92bd9c8f5ed94 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Thu, 18 Jun 2026 06:37:08 -0400 Subject: [PATCH] build: C++17 + -fno-aligned-allocation for macOS (C++17 aligned new needs 10.14; keep older deployment target) --- CMakeLists.txt | 9 ++++++++- contrib/depends/hosts/darwin.mk | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39db44794..8ea391059 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,10 +96,17 @@ enable_language(C ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +if(APPLE) + # C++17 aligned new/delete (std::align_val_t) require macOS deployment target >= 10.14. The depends + # macOS toolchain targets older (and Apple Silicon aarch64 cross-builds hit this on boost/any.hpp). + # Disable aligned allocation so wownero builds under C++17 on all macOS targets. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-allocation") +endif() + function (die msg) if (NOT WIN32) string(ASCII 27 Esc) diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk index 79d449054..34001bb3f 100644 --- a/contrib/depends/hosts/darwin.mk +++ b/contrib/depends/hosts/darwin.mk @@ -6,7 +6,7 @@ else CC_target=$(host) endif darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)- -darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)- +darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -fno-aligned-allocation -B$(host_prefix)/native/bin/$(host)- darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS)