depends: explicitely set C/CXX standard for all packages
What changed, and why it matters
This commit standardizes which C and C++ language versions are used when building Monero's external dependencies across all supported platforms. It sets a default of C11 and C++17, applies those defaults consistently to Android, macOS, FreeBSD, Linux, and Windows builds, and removes duplicate version flags from individual package recipes. The change is a build-system hardening and consistency improvement, not a fix for a known exploitable vulnerability.
Treat as a routine build-system maintenance commit. Reviewers may verify that the chosen C11/C++17 standards are compatible with the minimum supported compiler versions and that no package silently overrides the new defaults. No emergency response is warranted.
Security signals we found
Build-system hardening: explicit language standards reduce risk of compiler-default changes introducing undefined behavior or ABI incompatibilities.
No direct vulnerability fix: no buffer overflow, memory corruption, cryptographic, or consensus-critical change is present in the diff.
Potential secondary benefit: pinning C++17 may avoid use of deprecated/removed language features and improve deterministic builds.
Evidence from the diff
The patch introduces C_STANDARD ?= c11 and CXX_STANDARD ?= c++17 in contrib/depends/Makefile and propagates -std=$(C_STANDARD) / -std=$(CXX_STANDARD) into host-specific CFLAGS/CXXFLAGS for android, darwin, freebsd, linux, and mingw32. It also removes redundant $(package)_cxxflags=-std=c++11 (or c++17 for boost) from boost, native_protobuf, protobuf, and zeromq package makefiles. The effect is to centralize and make explicit the language standard selection for the depends build system, preventing silent drift when compiler defaults change.
Changed components
contrib/depends/Makefilecontrib/depends/hosts/android.mkcontrib/depends/hosts/darwin.mkcontrib/depends/hosts/freebsd.mkcontrib/depends/hosts/linux.mkcontrib/depends/hosts/mingw32.mkcontrib/depends/packages/boost.mkcontrib/depends/packages/native_protobuf.mkcontrib/depends/packages/protobuf.mkcontrib/depends/packages/zeromq.mkInspect captured patch +13 / −14
diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile
index 5f93075..0de02a7 100644
--- a/contrib/depends/Makefile
+++ b/contrib/depends/Makefile
@@ -8,6 +8,9 @@ SOURCES_PATH ?= $(BASEDIR)/sources
BASE_CACHE ?= $(BASEDIR)/built
FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources
+C_STANDARD ?= c11
+CXX_STANDARD ?= c++17
+
BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)
PATCHES_PATH = $(BASEDIR)/patches
diff --git a/contrib/depends/hosts/android.mk b/contrib/depends/hosts/android.mk
index a798910..77dc3c3 100644
--- a/contrib/depends/hosts/android.mk
+++ b/contrib/depends/hosts/android.mk
@@ -16,8 +16,8 @@ android_CXX=$(clear_guix_env) $(build_prefix)/bin/$(host_toolchain)clang++
android_AR=llvm-ar
android_RANLIB=llvm-ranlib
-android_CFLAGS=-pipe
-android_CXXFLAGS=$(android_CFLAGS)
+android_CFLAGS=-pipe -std=$(C_STANDARD)
+android_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
android_ARFLAGS=crsD
android_release_CFLAGS=-O2
diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk
index 70601dc..aa61d60 100644
--- a/contrib/depends/hosts/darwin.mk
+++ b/contrib/depends/hosts/darwin.mk
@@ -53,8 +53,8 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-iwithsysroot/usr/include/c++/v1 \
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
-darwin_CFLAGS=-pipe
-darwin_CXXFLAGS=$(darwin_CFLAGS)
+darwin_CFLAGS=-pipe -std=$(C_STANDARD)
+darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION) -Wl,-no_adhoc_codesign -fuse-ld=lld
darwin_ARFLAGS=cr
diff --git a/contrib/depends/hosts/freebsd.mk b/contrib/depends/hosts/freebsd.mk
index aeaccbf..549c578 100644
--- a/contrib/depends/hosts/freebsd.mk
+++ b/contrib/depends/hosts/freebsd.mk
@@ -13,8 +13,8 @@ freebsd_AR=ar
freebsd_RANLIB=ranlib
freebsd_NM=nm
-freebsd_CFLAGS=-pipe
-freebsd_CXXFLAGS=$(freebsd_CFLAGS)
+freebsd_CFLAGS=-pipe -std=$(C_STANDARD)
+freebsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
freebsd_ARFLAGS=cr
freebsd_release_CFLAGS=-O2
diff --git a/contrib/depends/hosts/linux.mk b/contrib/depends/hosts/linux.mk
index ba0c4c3..08fdcc1 100644
--- a/contrib/depends/hosts/linux.mk
+++ b/contrib/depends/hosts/linux.mk
@@ -1,5 +1,5 @@
-linux_CFLAGS=-pipe
-linux_CXXFLAGS=$(linux_CFLAGS)
+linux_CFLAGS=-pipe -std=$(C_STANDARD)
+linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
linux_ARFLAGS=cr
linux_release_CFLAGS=-O2
diff --git a/contrib/depends/hosts/mingw32.mk b/contrib/depends/hosts/mingw32.mk
index 58a9a92..e78318b 100644
--- a/contrib/depends/hosts/mingw32.mk
+++ b/contrib/depends/hosts/mingw32.mk
@@ -1,5 +1,5 @@
-mingw32_CFLAGS=-pipe
-mingw32_CXXFLAGS=$(mingw32_CFLAGS)
+mingw32_CFLAGS=-pipe -std=$(C_STANDARD)
+mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
mingw32_ARFLAGS=cr
mingw32_release_CFLAGS=-O2
diff --git a/contrib/depends/packages/boost.mk b/contrib/depends/packages/boost.mk
index d420091..bbada6a 100644
--- a/contrib/depends/packages/boost.mk
+++ b/contrib/depends/packages/boost.mk
@@ -20,7 +20,6 @@ $(package)_toolset_$(host_os)=gcc
$(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_config_libraries_$(host_os)="chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization"
$(package)_config_libraries_mingw32="chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale"
-$(package)_cxxflags=-std=c++17
$(package)_cxxflags_linux+=-fPIC
$(package)_cxxflags_freebsd+=-fPIC
$(package)_cxxflags_darwin+=-ffile-prefix-map=$($(package)_extract_dir)=/usr
diff --git a/contrib/depends/packages/native_protobuf.mk b/contrib/depends/packages/native_protobuf.mk
index 8d7649b..0ec5444 100644
--- a/contrib/depends/packages/native_protobuf.mk
+++ b/contrib/depends/packages/native_protobuf.mk
@@ -4,7 +4,6 @@ $(package)_version_protobuf_cpp=3.21.12
$(package)_download_path=https://github.com/protocolbuffers/protobuf/releases/download/v$($(package)_version)/
$(package)_file_name=protobuf-cpp-$($(package)_version_protobuf_cpp).tar.gz
$(package)_sha256_hash=4eab9b524aa5913c6fffb20b2a8abf5ef7f95a80bc0701f3a6dbb4c607f73460
-$(package)_cxxflags=-std=c++11
define $(package)_set_vars
$(package)_config_opts=--disable-shared --prefix=$(build_prefix)
diff --git a/contrib/depends/packages/protobuf.mk b/contrib/depends/packages/protobuf.mk
index 9702506..8525749 100644
--- a/contrib/depends/packages/protobuf.mk
+++ b/contrib/depends/packages/protobuf.mk
@@ -5,7 +5,6 @@ $(package)_download_path=$(native_$(package)_download_path)
$(package)_file_name=$(native_$(package)_file_name)
$(package)_sha256_hash=$(native_$(package)_sha256_hash)
$(package)_dependencies=native_$(package)
-$(package)_cxxflags=-std=c++11
define $(package)_set_vars
$(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc
diff --git a/contrib/depends/packages/zeromq.mk b/contrib/depends/packages/zeromq.mk
index cdf598b..7255790 100644
--- a/contrib/depends/packages/zeromq.mk
+++ b/contrib/depends/packages/zeromq.mk
@@ -6,7 +6,6 @@ $(package)_sha256_hash=6653ef5910f17954861fe72332e68b03ca6e4d9c7160eb3a8de5a5a91
define $(package)_set_vars
$(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve
- $(package)_cxxflags=-std=c++11
endef
define $(package)_preprocess_cmds
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.