From 63f53de380732ab4c088c6b6d7eb48e33310eea9 Mon Sep 17 00:00:00 2001 From: "Austin S. Hemmelgarn" Date: Fri, 9 Feb 2024 06:51:41 -0500 Subject: [PATCH 1/2] Use C++14 by default when building on systems that support it. (#16972) This is needed to properly support the latest versions of Protobuf. --- CMakeLists.txt | 8 +++++++- netdata-installer.sh | 3 +++ netdata.spec.in | 5 +++++ packaging/installer/functions.sh | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48326c887bdff0..944a5105eca9f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,13 @@ project(netdata find_package(PkgConfig REQUIRED) set(CMAKE_C_STANDARD 11) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) + +option(USE_CXX_11 "use C++11 instead of C++14" False) + +if(USE_CXX_11) + set(CMAKE_CXX_STANDARD 11) +endif() set(CMAKE_C_STANDARD_REQUIRED On) set(CMAKE_CXX_STANDARD_REQUIRED On) diff --git a/netdata-installer.sh b/netdata-installer.sh index bce098dd91bbd8..d2fe1a2abde897 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -209,6 +209,7 @@ USAGE: ${PROGRAM} [options] --disable-ebpf Disable eBPF Kernel plugin. Default: enabled. --disable-cloud Disable all Netdata Cloud functionality. --require-cloud Fail the install if it can't build Netdata Cloud support. + --force-legacy-cxx Force usage of an older C++ standard to allow building on older systems. This will usually be autodetected. --enable-plugin-freeipmi Enable the FreeIPMI plugin. Default: enable it when libipmimonitoring is available. --disable-plugin-freeipmi Explicitly disable the FreeIPMI plugin. --disable-https Explicitly disable TLS support. @@ -257,6 +258,7 @@ ENABLE_H2O=1 ENABLE_CLOUD=1 ENABLE_LOGS_MANAGEMENT=1 ENABLE_LOGS_MANAGEMENT_TESTS=0 +FORCE_LEGACY_CXX=0 NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS-}" RELEASE_CHANNEL="nightly" # valid values are 'nightly' and 'stable' @@ -273,6 +275,7 @@ while [ -n "${1}" ]; do "--auto-update-type") ;; "--stable-channel") RELEASE_CHANNEL="stable" ;; "--nightly-channel") RELEASE_CHANNEL="nightly" ;; + "--force-legacy-cxx") FORCE_LEGACY_CXX=1 ;; "--enable-plugin-freeipmi") ENABLE_FREEIPMI=1 ;; "--disable-plugin-freeipmi") ENABLE_FREEIPMI=0 ;; "--disable-https") diff --git a/netdata.spec.in b/netdata.spec.in index 1a099ce6f0b532..ad0a6a36f0c664 100644 --- a/netdata.spec.in +++ b/netdata.spec.in @@ -352,6 +352,11 @@ make download # Conf step %cmake -G Ninja \ -DCMAKE_INSTALL_PREFIX=/ \ + %if 0%{?centos_ver:1} + %if %{centos_ver} < 8 + -DUSE_CXX_11=On \ + %endif + %endif %if %{_have_cups} -DENABLE_PLUGIN_CUPS=On \ %else diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index 0eea4d4a47ce81..9a0df58e9ab4de 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -235,6 +235,28 @@ check_for_feature() { prepare_cmake_options() { NETDATA_CMAKE_OPTIONS="-S ./ -B ${NETDATA_BUILD_DIR} ${CMAKE_OPTS} ${NETDATA_PREFIX+-DCMAKE_INSTALL_PREFIX="${NETDATA_PREFIX}"} ${NETDATA_USER:+-DNETDATA_USER=${NETDATA_USER}} ${NETDATA_CMAKE_OPTIONS} " + NEED_OLD_CXX=0 + + if [ "${FORCE_LEGACY_CXX:-0}" -eq 1 ]; then + NEED_OLD_CXX=1 + else + if command -v gcc >/dev/null 2>&1; then + if [ "$(gcc --version | head -n 1 | sed 's/(.*) //' | cut -f 2 -d ' ' | cut -f 1 -d '.')" -lt 5 ]; then + NEED_OLD_CXX=1 + fi + fi + + if command -v clang >/dev/null 2>&1; then + if [ "$(clang --version | head -n 1 | cut -f 3 -d ' ' | cut -f 1 -d '.')" -lt 4 ]; then + NEED_OLD_CXX=1 + fi + fi + fi + + if [ "${NEED_OLD_CXX}" -eq 1 ]; then + NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DUSE_CXX_11=On" + fi + if [ "${USE_SYSTEM_PROTOBUF:-1}" -eq 1 ]; then enable_feature BUNDLED_PROTOBUF 0 else From dfdc26a53ad10846de5bbf9a76775924e8bf0524 Mon Sep 17 00:00:00 2001 From: netdatabot Date: Sat, 10 Feb 2024 00:15:22 +0000 Subject: [PATCH 2/2] [ci skip] Update changelog and version for nightly build: v1.44.0-351-nightly. --- CHANGELOG.md | 3 +-- packaging/version | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a382e2f5f0d238..3db0c9464c58db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ **Merged pull requests:** - Regenerate integrations.js [\#16974](https://github.com/netdata/netdata/pull/16974) ([netdatabot](https://github.com/netdatabot)) +- Use C++14 by default when building on systems that support it. [\#16972](https://github.com/netdata/netdata/pull/16972) ([Ferroin](https://github.com/Ferroin)) - change edac ecc errors from incremental to absolute [\#16970](https://github.com/netdata/netdata/pull/16970) ([ilyam8](https://github.com/ilyam8)) - update go.d.plugin version to v0.58.1 [\#16968](https://github.com/netdata/netdata/pull/16968) ([ilyam8](https://github.com/ilyam8)) - fix move collectors to src/ leftovers [\#16967](https://github.com/netdata/netdata/pull/16967) ([ilyam8](https://github.com/ilyam8)) @@ -399,8 +400,6 @@ - Regenerate integrations.js [\#16386](https://github.com/netdata/netdata/pull/16386) ([netdatabot](https://github.com/netdatabot)) - skip spaces when reading cpuset [\#16385](https://github.com/netdata/netdata/pull/16385) ([ilyam8](https://github.com/ilyam8)) - Regenerate integrations.js [\#16384](https://github.com/netdata/netdata/pull/16384) ([netdatabot](https://github.com/netdatabot)) -- use pre-configured message\_ids to identify common logs [\#16383](https://github.com/netdata/netdata/pull/16383) ([ktsaou](https://github.com/ktsaou)) -- Handle ephemeral hosts [\#16381](https://github.com/netdata/netdata/pull/16381) ([stelfrag](https://github.com/stelfrag)) ## [v1.43.2](https://github.com/netdata/netdata/tree/v1.43.2) (2023-10-30) diff --git a/packaging/version b/packaging/version index d237ea0e3d6fcf..07de13f1aeb4cf 100644 --- a/packaging/version +++ b/packaging/version @@ -1 +1 @@ -v1.44.0-349-nightly +v1.44.0-351-nightly