From 341c4859b76336e15c15d06aa192050c75e90236 Mon Sep 17 00:00:00 2001 From: Kirk Rodrigues <2454684+kirkrodrigues@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:26:21 -0400 Subject: [PATCH 01/12] build(core): Lock CMake to v3.31.6 on macOS to mitigate #793. --- .../core/tools/scripts/lib_install/macos/install-all.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index b7f16d1f30..ce3ba6d9a1 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -7,9 +7,16 @@ set -e set -u brew update + +# Install CMake v3.31.6 since we're using yaml-cpp that doesn't yet support CMake v4 yet +cmake_formula_path=/tmp/cmake.rb +curl --fail --show-error --location --remote-name \ + https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb \ + --output "${cmake_formula_path}" +brew install --formula "${cmake_formula_path}" + brew install \ boost \ - cmake \ coreutils \ fmt \ gcc \ From eb903f9455885e990848bcda4a4f9ab635e71b12 Mon Sep 17 00:00:00 2001 From: Kirk Rodrigues <2454684+kirkrodrigues@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:31:20 -0400 Subject: [PATCH 02/12] Fix argument order. --- .../core/tools/scripts/lib_install/macos/install-all.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index ce3ba6d9a1..551ae74036 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -11,8 +11,8 @@ brew update # Install CMake v3.31.6 since we're using yaml-cpp that doesn't yet support CMake v4 yet cmake_formula_path=/tmp/cmake.rb curl --fail --show-error --location --remote-name \ - https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb \ - --output "${cmake_formula_path}" + --output "${cmake_formula_path}" \ + https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb brew install --formula "${cmake_formula_path}" brew install \ From 954a769aab3a09edeffe782da4d22112cb789e1c Mon Sep 17 00:00:00 2001 From: Kirk Rodrigues <2454684+kirkrodrigues@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:35:56 -0400 Subject: [PATCH 03/12] Remove unnecessary argument. --- components/core/tools/scripts/lib_install/macos/install-all.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index 551ae74036..bbf55ea05e 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -10,8 +10,7 @@ brew update # Install CMake v3.31.6 since we're using yaml-cpp that doesn't yet support CMake v4 yet cmake_formula_path=/tmp/cmake.rb -curl --fail --show-error --location --remote-name \ - --output "${cmake_formula_path}" \ +curl --fail --show-error --location --output "${cmake_formula_path}" \ https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb brew install --formula "${cmake_formula_path}" From 9268619378b782b8c2c6fe7e4cbe6ae2ada71f1b Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Tue, 1 Apr 2025 11:46:55 -0400 Subject: [PATCH 04/12] Enforce to use cmake version under 4.0.0. y-scope#795 --- .../lib_install/centos-stream-9/install-all.sh | 3 +++ .../core/tools/scripts/lib_install/check-cmake.sh | 14 ++++++++++++++ .../tools/scripts/lib_install/macos/install-all.sh | 3 +++ .../lib_install/ubuntu-focal/install-all.sh | 7 +++++-- .../lib_install/ubuntu-jammy/install-all.sh | 7 +++++-- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100755 components/core/tools/scripts/lib_install/check-cmake.sh diff --git a/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh b/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh index c50fb81cc7..abc7a3a8f1 100755 --- a/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh +++ b/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh @@ -10,3 +10,6 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" "${script_dir}/install-prebuilt-packages.sh" "${script_dir}/install-packages-from-source.sh" + +# TODO: https://github.com/y-scope/clp/issues/795 +"${script_dir}/../check-cmake.sh" diff --git a/components/core/tools/scripts/lib_install/check-cmake.sh b/components/core/tools/scripts/lib_install/check-cmake.sh new file mode 100755 index 0000000000..e8d34694f6 --- /dev/null +++ b/components/core/tools/scripts/lib_install/check-cmake.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Exit on error +set -e + +# Get the installed cmake version string +cmake_version=$(cmake --version | head -n1 | awk '{print $3}') +cmake_major_version=$(echo "$cmake_version" | cut -d. -f1) + +# Check if version is 4.0 or higher +if [[ "$cmake_major_version" -ge "4" ]]; then + echo "CMake version $cmake_version is not supported (>= 4.0)." + exit 1 +fi diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index bbf55ea05e..2cc1633aa4 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -38,3 +38,6 @@ brew install \ if ! command -v pkg-config ; then brew install pkg-config fi + +# TODO: https://github.com/y-scope/clp/issues/795 +"${script_dir}/../check-cmake.sh" diff --git a/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh b/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh index e338a30d76..abc7a3a8f1 100755 --- a/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh +++ b/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh @@ -8,5 +8,8 @@ set -u script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -"$script_dir"/install-prebuilt-packages.sh -"$script_dir"/install-packages-from-source.sh +"${script_dir}/install-prebuilt-packages.sh" +"${script_dir}/install-packages-from-source.sh" + +# TODO: https://github.com/y-scope/clp/issues/795 +"${script_dir}/../check-cmake.sh" diff --git a/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh b/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh index e338a30d76..abc7a3a8f1 100755 --- a/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh +++ b/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh @@ -8,5 +8,8 @@ set -u script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -"$script_dir"/install-prebuilt-packages.sh -"$script_dir"/install-packages-from-source.sh +"${script_dir}/install-prebuilt-packages.sh" +"${script_dir}/install-packages-from-source.sh" + +# TODO: https://github.com/y-scope/clp/issues/795 +"${script_dir}/../check-cmake.sh" From 0ddd87d0b90fc96808b0904a9fb94fd639241641 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Tue, 1 Apr 2025 18:38:08 -0400 Subject: [PATCH 05/12] Fix MacOS missing variable def --- components/core/tools/scripts/lib_install/macos/install-all.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index 2cc1633aa4..d13f3c0b0e 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -40,4 +40,5 @@ if ! command -v pkg-config ; then fi # TODO: https://github.com/y-scope/clp/issues/795 +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" "${script_dir}/../check-cmake.sh" From 51d88db64fca030bcd048fb8845c8a455bf82435 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 00:40:31 -0400 Subject: [PATCH 06/12] Apply suggestions from code review Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com> Co-authored-by: Junhao Liao --- .../core/tools/scripts/lib_install/check-cmake.sh | 12 ++++++++---- .../tools/scripts/lib_install/macos/install-all.sh | 7 ++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/components/core/tools/scripts/lib_install/check-cmake.sh b/components/core/tools/scripts/lib_install/check-cmake.sh index e8d34694f6..c7487f298e 100755 --- a/components/core/tools/scripts/lib_install/check-cmake.sh +++ b/components/core/tools/scripts/lib_install/check-cmake.sh @@ -1,14 +1,18 @@ #!/usr/bin/env bash -# Exit on error +# Exit on any error set -e +# Error on undefined variable +set -u + # Get the installed cmake version string -cmake_version=$(cmake --version | head -n1 | awk '{print $3}') +cmake_version=$(cmake --version | head --lines 1 | awk '{print $3}') cmake_major_version=$(echo "$cmake_version" | cut -d. -f1) # Check if version is 4.0 or higher -if [[ "$cmake_major_version" -ge "4" ]]; then - echo "CMake version $cmake_version is not supported (>= 4.0)." +# shellcheck disable=SC2071 +if ! [[ "$cmake_version" < "4" ]]; then + echo "CMake version $cmake_version is currently unsupported (>= 4.0)." exit 1 fi diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index d13f3c0b0e..4c7c8464f3 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -8,10 +8,11 @@ set -u brew update -# Install CMake v3.31.6 since we're using yaml-cpp that doesn't yet support CMake v4 yet +# Install CMake v3.31.6 as ANTLR and yaml-cpp do not yet support CMake v4+. cmake_formula_path=/tmp/cmake.rb -curl --fail --show-error --location --output "${cmake_formula_path}" \ - https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb +curl --fail --location --show-error \ + https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb \ + --output "${cmake_formula_path}" brew install --formula "${cmake_formula_path}" brew install \ From 38e431146d2419aefb973bd06224cc04cbff2ccb Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 00:45:38 -0400 Subject: [PATCH 07/12] Rename check cmake version script file --- .../tools/scripts/lib_install/centos-stream-9/install-all.sh | 2 +- .../lib_install/{check-cmake.sh => check-cmake-version.sh} | 0 components/core/tools/scripts/lib_install/macos/install-all.sh | 3 ++- .../core/tools/scripts/lib_install/ubuntu-focal/install-all.sh | 2 +- .../core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) rename components/core/tools/scripts/lib_install/{check-cmake.sh => check-cmake-version.sh} (100%) diff --git a/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh b/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh index abc7a3a8f1..a44de8130c 100755 --- a/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh +++ b/components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh @@ -12,4 +12,4 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" "${script_dir}/install-packages-from-source.sh" # TODO: https://github.com/y-scope/clp/issues/795 -"${script_dir}/../check-cmake.sh" +"${script_dir}/../check-cmake-version.sh" diff --git a/components/core/tools/scripts/lib_install/check-cmake.sh b/components/core/tools/scripts/lib_install/check-cmake-version.sh similarity index 100% rename from components/core/tools/scripts/lib_install/check-cmake.sh rename to components/core/tools/scripts/lib_install/check-cmake-version.sh diff --git a/components/core/tools/scripts/lib_install/macos/install-all.sh b/components/core/tools/scripts/lib_install/macos/install-all.sh index 4c7c8464f3..b1d3605dca 100755 --- a/components/core/tools/scripts/lib_install/macos/install-all.sh +++ b/components/core/tools/scripts/lib_install/macos/install-all.sh @@ -9,6 +9,7 @@ set -u brew update # Install CMake v3.31.6 as ANTLR and yaml-cpp do not yet support CMake v4+. +# See also: https://github.com/y-scope/clp/issues/795 cmake_formula_path=/tmp/cmake.rb curl --fail --location --show-error \ https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb \ @@ -42,4 +43,4 @@ fi # TODO: https://github.com/y-scope/clp/issues/795 script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -"${script_dir}/../check-cmake.sh" +"${script_dir}/../check-cmake-version.sh" diff --git a/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh b/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh index abc7a3a8f1..a44de8130c 100755 --- a/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh +++ b/components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh @@ -12,4 +12,4 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" "${script_dir}/install-packages-from-source.sh" # TODO: https://github.com/y-scope/clp/issues/795 -"${script_dir}/../check-cmake.sh" +"${script_dir}/../check-cmake-version.sh" diff --git a/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh b/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh index abc7a3a8f1..a44de8130c 100755 --- a/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh +++ b/components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh @@ -12,4 +12,4 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" "${script_dir}/install-packages-from-source.sh" # TODO: https://github.com/y-scope/clp/issues/795 -"${script_dir}/../check-cmake.sh" +"${script_dir}/../check-cmake-version.sh" From 9ecc8681e07dbbdd2aa70304ec956091e7a711ef Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 00:49:47 -0400 Subject: [PATCH 08/12] Use cmake -E capabilities which does not rely on custom parsing --- .../core/tools/scripts/lib_install/check-cmake-version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/core/tools/scripts/lib_install/check-cmake-version.sh b/components/core/tools/scripts/lib_install/check-cmake-version.sh index c7487f298e..65a1b5739b 100755 --- a/components/core/tools/scripts/lib_install/check-cmake-version.sh +++ b/components/core/tools/scripts/lib_install/check-cmake-version.sh @@ -7,12 +7,12 @@ set -e set -u # Get the installed cmake version string -cmake_version=$(cmake --version | head --lines 1 | awk '{print $3}') -cmake_major_version=$(echo "$cmake_version" | cut -d. -f1) +cmake_version=$(cmake -E capabilities | jq ".version.string") +cmake_major_version=$(cmake -E capabilities | jq ".version.major") # Check if version is 4.0 or higher # shellcheck disable=SC2071 -if ! [[ "$cmake_version" < "4" ]]; then +if ! [[ "$cmake_major_version" < "4" ]]; then echo "CMake version $cmake_version is currently unsupported (>= 4.0)." exit 1 fi From 3869dcdc520335a6857617809f8b5f7b2cf9926b Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 10:18:18 -0400 Subject: [PATCH 09/12] Remove quotes around version string during jq --- .../core/tools/scripts/lib_install/check-cmake-version.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/core/tools/scripts/lib_install/check-cmake-version.sh b/components/core/tools/scripts/lib_install/check-cmake-version.sh index 65a1b5739b..ecbf3b62e2 100755 --- a/components/core/tools/scripts/lib_install/check-cmake-version.sh +++ b/components/core/tools/scripts/lib_install/check-cmake-version.sh @@ -7,12 +7,11 @@ set -e set -u # Get the installed cmake version string -cmake_version=$(cmake -E capabilities | jq ".version.string") -cmake_major_version=$(cmake -E capabilities | jq ".version.major") +cmake_version=$(cmake -E capabilities | jq -r ".version.string") # Check if version is 4.0 or higher # shellcheck disable=SC2071 -if ! [[ "$cmake_major_version" < "4" ]]; then +if ! [[ $cmake_version < "4" ]]; then echo "CMake version $cmake_version is currently unsupported (>= 4.0)." exit 1 fi From a9f0991a4b2adeaa73e74803df3f49324cbe0097 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 10:20:11 -0400 Subject: [PATCH 10/12] Use long option --- .../core/tools/scripts/lib_install/check-cmake-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/core/tools/scripts/lib_install/check-cmake-version.sh b/components/core/tools/scripts/lib_install/check-cmake-version.sh index ecbf3b62e2..66e24c358d 100755 --- a/components/core/tools/scripts/lib_install/check-cmake-version.sh +++ b/components/core/tools/scripts/lib_install/check-cmake-version.sh @@ -7,7 +7,7 @@ set -e set -u # Get the installed cmake version string -cmake_version=$(cmake -E capabilities | jq -r ".version.string") +cmake_version=$(cmake -E capabilities | jq --raw-output ".version.string") # Check if version is 4.0 or higher # shellcheck disable=SC2071 From 614688db8bec16430fa907eb3fbaad2a39f174e5 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 11:42:59 -0400 Subject: [PATCH 11/12] Revert to using cmake major version --- .../core/tools/scripts/lib_install/check-cmake-version.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/core/tools/scripts/lib_install/check-cmake-version.sh b/components/core/tools/scripts/lib_install/check-cmake-version.sh index 66e24c358d..7d9a074b62 100755 --- a/components/core/tools/scripts/lib_install/check-cmake-version.sh +++ b/components/core/tools/scripts/lib_install/check-cmake-version.sh @@ -8,10 +8,11 @@ set -u # Get the installed cmake version string cmake_version=$(cmake -E capabilities | jq --raw-output ".version.string") +cmake_major_version=$(cmake -E capabilities | jq --raw-output ".version.major") # Check if version is 4.0 or higher # shellcheck disable=SC2071 -if ! [[ $cmake_version < "4" ]]; then +if ! [[ "$cmake_major_version" < "4" ]]; then echo "CMake version $cmake_version is currently unsupported (>= 4.0)." exit 1 fi From cb88d876f03a46b25e2f929aa408509b8a9ee157 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 2 Apr 2025 11:53:11 -0400 Subject: [PATCH 12/12] Use number comparison --- .../core/tools/scripts/lib_install/check-cmake-version.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/core/tools/scripts/lib_install/check-cmake-version.sh b/components/core/tools/scripts/lib_install/check-cmake-version.sh index 7d9a074b62..d942b9ce98 100755 --- a/components/core/tools/scripts/lib_install/check-cmake-version.sh +++ b/components/core/tools/scripts/lib_install/check-cmake-version.sh @@ -11,8 +11,7 @@ cmake_version=$(cmake -E capabilities | jq --raw-output ".version.string") cmake_major_version=$(cmake -E capabilities | jq --raw-output ".version.major") # Check if version is 4.0 or higher -# shellcheck disable=SC2071 -if ! [[ "$cmake_major_version" < "4" ]]; then +if [[ "$cmake_major_version" -ge "4" ]]; then echo "CMake version $cmake_version is currently unsupported (>= 4.0)." exit 1 fi