From 4ad1bd6b0e339aa02c7d3e70fac10a7ff7145080 Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Thu, 27 Jul 2023 21:14:19 +0200 Subject: [PATCH 1/5] MINIFICPP-2175 Increase CMAKE requirements to 3.24 --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 2 +- README.md | 2 +- centos.sh | 8 +------- docker/Dockerfile | 2 +- docker/centos/Dockerfile | 2 +- docker/rockylinux/Dockerfile | 4 ++-- linux.sh | 27 +++++++++++++++++++++++++++ 8 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9eff11a071..5ba42fe6f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -332,7 +332,7 @@ jobs: path: /tmp/bin docker_build: name: "Docker build for integration tests" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 180 steps: - id: checkout diff --git a/CMakeLists.txt b/CMakeLists.txt index 6600abd9ce..17ea231dac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ # under the License. # -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.24) cmake_policy(SET CMP0096 NEW) # policy to preserve the leading zeros in PROJECT_VERSION_{MAJOR,MINOR,PATCH,TWEAK} cmake_policy(SET CMP0065 OLD) # default export policy, required for self-dlopen if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24) diff --git a/README.md b/README.md index 1866219c27..060eacddfc 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Through JNI extensions you can run NiFi processors using NARs. The JNI extension ### To build #### Utilities -* CMake 3.17 or greater +* CMake 3.24 or greater * gcc 11 or greater * bison 3.0.x+ (3.2 has been shown to fail builds) * flex 2.6 or greater diff --git a/centos.sh b/centos.sh index 1649c775a8..000a47800d 100644 --- a/centos.sh +++ b/centos.sh @@ -57,13 +57,7 @@ install_libusb() { bootstrap_cmake(){ - case "$OS_MAJOR" in - 7) - install_pkgs epel-release - install_pkgs cmake3 - ;; - *) install_pkgs cmake ;; - esac + install_cmake_from_binary } bootstrap_compiler() { diff --git a/docker/Dockerfile b/docker/Dockerfile index 6de245ac74..e3ee1022ef 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -ARG BASE_IMAGE="alpine:3.16" +ARG BASE_IMAGE="alpine:3.17" # Build image FROM ${BASE_IMAGE} AS build diff --git a/docker/centos/Dockerfile b/docker/centos/Dockerfile index 9ae84e4261..19449ff62c 100644 --- a/docker/centos/Dockerfile +++ b/docker/centos/Dockerfile @@ -69,5 +69,5 @@ RUN cd $MINIFI_BASE_DIR && \ source /opt/rh/devtoolset-11/enable && \ export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \ export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \ - cmake3 -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \ + cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \ make -j "$(nproc)" ${DOCKER_MAKE_TARGET} diff --git a/docker/rockylinux/Dockerfile b/docker/rockylinux/Dockerfile index d90112e8f5..fe02f5ce82 100644 --- a/docker/rockylinux/Dockerfile +++ b/docker/rockylinux/Dockerfile @@ -40,7 +40,7 @@ COPY . ${MINIFI_BASE_DIR} # Install the system dependencies needed for a build # gpsd-devel and ccache are in EPEL -RUN dnf -y install epel-release && dnf -y install sudo git which make libarchive ccache ca-certificates cmake perl && \ +RUN dnf -y install epel-release && dnf -y install sudo git which make libarchive ccache ca-certificates perl && \ if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_GPS=ON"; then dnf -y install gpsd-devel; fi && \ if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_JNI=ON"; then dnf -y install java-1.8.0-openjdk maven; fi && \ if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_PCAP=ON"; then dnf -y install libpcap-devel; fi && \ @@ -66,5 +66,5 @@ RUN cd $MINIFI_BASE_DIR && \ source /opt/rh/gcc-toolset-12/enable && \ export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \ export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \ - cmake3 -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \ + cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \ make -j "$(nproc)" ${DOCKER_MAKE_TARGET} diff --git a/linux.sh b/linux.sh index c172bdd476..6e9a05a653 100644 --- a/linux.sh +++ b/linux.sh @@ -19,3 +19,30 @@ verify_gcc_enable(){ #feature="$1" [ "$COMPILER_MAJOR" -ge 11 ] && echo true || echo false } + +install_cmake_from_binary() { + CMAKE_VERSION="3.24.4" + CMAKE_URL="https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.tar.gz" + EXPECTED_SHA256="cac77d28fb8668c179ac02c283b058aeb846fe2133a57d40b503711281ed9f19" + + TMP_DIR=$(mktemp -d) + + install_pkgs wget + wget -P "$TMP_DIR" "$CMAKE_URL" + + ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | awk '{print $1}') + + if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then + echo "ERROR: SHA-256 verification failed. Aborting." + rm -r "$TMP_DIR" + exit 1 + fi + + tar -C "$TMP_DIR" -zxvf "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" + sudo mv "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64" /opt/cmake-$CMAKE_VERSION + + sudo ln -s "/opt/cmake-$CMAKE_VERSION/bin/cmake" /usr/local/bin/cmake + + echo "CMake $CMAKE_VERSION has been installed successfully." + rm -r "$TMP_DIR" +} From a93ea44a31050eabc3760f98285c2a2bbd296718 Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Mon, 14 Aug 2023 11:00:21 +0200 Subject: [PATCH 2/5] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Márton Szász --- linux.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linux.sh b/linux.sh index 6e9a05a653..f78795de17 100644 --- a/linux.sh +++ b/linux.sh @@ -30,7 +30,7 @@ install_cmake_from_binary() { install_pkgs wget wget -P "$TMP_DIR" "$CMAKE_URL" - ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | awk '{print $1}') + ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | cut -d " " -f 2) if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then echo "ERROR: SHA-256 verification failed. Aborting." @@ -38,10 +38,13 @@ install_cmake_from_binary() { exit 1 fi - tar -C "$TMP_DIR" -zxvf "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" + echo "Installing CMake $CMAKE_VERSION to /opt/cmake-$CMAKE_VERSION..." + set -x + tar -C "$TMP_DIR" -zxf "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" sudo mv "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64" /opt/cmake-$CMAKE_VERSION sudo ln -s "/opt/cmake-$CMAKE_VERSION/bin/cmake" /usr/local/bin/cmake + set +x echo "CMake $CMAKE_VERSION has been installed successfully." rm -r "$TMP_DIR" From dc0eeeb482b98d4ad934c8478985e1420b80bac8 Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Mon, 14 Aug 2023 10:57:21 +0200 Subject: [PATCH 3/5] use 3.18 docker --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e3ee1022ef..0b1c788174 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -ARG BASE_IMAGE="alpine:3.17" +ARG BASE_IMAGE="alpine:3.18" # Build image FROM ${BASE_IMAGE} AS build From 002cc55a594917111433b9d256afa8739d7a858f Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Mon, 14 Aug 2023 15:31:41 +0200 Subject: [PATCH 4/5] fix install_cmake_from_binary --- linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux.sh b/linux.sh index f78795de17..2d58dcf1c0 100644 --- a/linux.sh +++ b/linux.sh @@ -30,7 +30,7 @@ install_cmake_from_binary() { install_pkgs wget wget -P "$TMP_DIR" "$CMAKE_URL" - ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | cut -d " " -f 2) + ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | cut -d " " -f 1) if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then echo "ERROR: SHA-256 verification failed. Aborting." From e92525fc9fbfd0d0f40f663da6b932e4f53a44fa Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Mon, 14 Aug 2023 17:27:16 +0200 Subject: [PATCH 5/5] Revert "use 3.18 docker" This reverts commit c32c9828925057c9967555612a4cac92b3b81e80. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0b1c788174..e3ee1022ef 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -ARG BASE_IMAGE="alpine:3.18" +ARG BASE_IMAGE="alpine:3.17" # Build image FROM ${BASE_IMAGE} AS build