From c7427469771cfade01d7e45f6242d79d3a66b72a Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 26 Apr 2024 15:16:17 -0700 Subject: [PATCH 1/8] Add more complete linux build instructions I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements. Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported. --- docs/workflow/requirements/linux-requirements.md | 8 ++++++++ eng/debian-reqs.txt | 15 +++++++++++++++ eng/native/build-commons.sh | 3 +++ 3 files changed, 26 insertions(+) create mode 100644 eng/debian-reqs.txt diff --git a/docs/workflow/requirements/linux-requirements.md b/docs/workflow/requirements/linux-requirements.md index 334e5e2ae354c3..36e962fe3c7526 100644 --- a/docs/workflow/requirements/linux-requirements.md +++ b/docs/workflow/requirements/linux-requirements.md @@ -40,6 +40,14 @@ Install the following packages for the toolchain: * zlib1g-dev * ninja-build (optional, enables building native code with ninja instead of make) +You can install all the above dependencies by running + +```bash +sudo xargs apt-get install -Y < eng/debian-reqs.txt +``` + +### Community-supported environments + **NOTE**: If you have an Ubuntu version older than 22.04 LTS, or Debian version older than 12, don't install `cmake` using `apt` directly. Follow the note written down below. ```bash diff --git a/eng/debian-reqs.txt b/eng/debian-reqs.txt new file mode 100644 index 00000000000000..719603aee2f225 --- /dev/null +++ b/eng/debian-reqs.txt @@ -0,0 +1,15 @@ +cmake +llvm +lld +clang +build-essential +python-is-python3 +curl +git +lldb +libicu-dev +liblttng-ust-dev +libssl-dev +libkrb5-dev +zlib1g-dev +ninja-build diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 0916abb396fa46..24cd3cd715690a 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -39,6 +39,9 @@ check_prereqs() # We try again with the PKG_CONFIG_PATH in place, if pkg-config still can't find OpenSSL, exit with an error, cmake won't find OpenSSL either pkg-config openssl || { echo >&2 "Please install openssl before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/macos-requirements.md"; exit 1; } fi + elif [[ "$__HostOS" == "linux" ]]; then + # Check presence of pkg-config on the path + command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; } fi if [[ "$__UseNinja" == 1 ]]; then From ff5a2b93bbc502e65c0166e535aec10b06a53d3d Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Mon, 29 Apr 2024 10:00:33 -0700 Subject: [PATCH 2/8] Update eng/native/build-commons.sh Co-authored-by: Jan Kotas --- eng/native/build-commons.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 24cd3cd715690a..f16ca9ea05dee8 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -40,7 +40,7 @@ check_prereqs() pkg-config openssl || { echo >&2 "Please install openssl before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/macos-requirements.md"; exit 1; } fi elif [[ "$__HostOS" == "linux" ]]; then - # Check presence of pkg-config on the path + # Check presence of cmake on the path command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; } fi From 130b59ed1466901007158adcdeb78f063d1f098a Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 30 Apr 2024 10:30:55 -0700 Subject: [PATCH 3/8] Unify build requirements --- .../requirements/linux-requirements.md | 20 ++----------------- eng/debian-reqs.txt | 20 +++++++++++-------- eng/install-native-dependencies.sh | 5 +++-- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/docs/workflow/requirements/linux-requirements.md b/docs/workflow/requirements/linux-requirements.md index 36e962fe3c7526..d0e0c48105fec5 100644 --- a/docs/workflow/requirements/linux-requirements.md +++ b/docs/workflow/requirements/linux-requirements.md @@ -22,28 +22,12 @@ Minimum RAM required to build is 1GB. The build is known to fail on 512 MB VMs ( ### Toolchain Setup -Install the following packages for the toolchain: - -* CMake 3.20 or newer -* llvm -* lld -* clang -* build-essential -* python-is-python3 -* curl -* git -* lldb -* libicu-dev -* liblttng-ust-dev -* libssl-dev -* libkrb5-dev -* zlib1g-dev -* ninja-build (optional, enables building native code with ninja instead of make) +Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt). You can install all the above dependencies by running ```bash -sudo xargs apt-get install -Y < eng/debian-reqs.txt +sudo ./eng/install-native-dependencies.sh ``` ### Community-supported environments diff --git a/eng/debian-reqs.txt b/eng/debian-reqs.txt index 719603aee2f225..d549245657c9a7 100644 --- a/eng/debian-reqs.txt +++ b/eng/debian-reqs.txt @@ -1,15 +1,19 @@ -cmake -llvm -lld -clang build-essential -python-is-python3 +clang +cmake curl +gettext git -lldb libicu-dev +libkrb5-dev +liblldb-dev liblttng-ust-dev libssl-dev -libkrb5-dev -zlib1g-dev +libunwind8-dev +lld +lldb +llvm +locales ninja-build +python-is-python3 +zlib1g-dev \ No newline at end of file diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 42a3727b3188a0..63f1c9b25dafa5 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -11,20 +11,21 @@ set -e os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" if [ -z "$os" ]; then + # shellcheck source-path=SCRIPTDIR . "$(dirname "$0")"/common/native/init-os-and-arch.sh fi case "$os" in linux) if [ -e /etc/os-release ]; then + # shellcheck source=/dev/null . /etc/os-release fi if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then apt update - apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ - libssl-dev libkrb5-dev zlib1g-dev + xargs apt-get install -y < eng/debian-reqs.txt localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 elif [ "$ID" = "alpine" ]; then From ad5a56ff7437b41b1460790a84c6d2adb75e6c8b Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 14 May 2024 10:34:47 -0700 Subject: [PATCH 4/8] Respond to PR comments --- eng/debian-reqs.txt | 19 ------------------- eng/install-native-dependencies.sh | 3 ++- 2 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 eng/debian-reqs.txt diff --git a/eng/debian-reqs.txt b/eng/debian-reqs.txt deleted file mode 100644 index d549245657c9a7..00000000000000 --- a/eng/debian-reqs.txt +++ /dev/null @@ -1,19 +0,0 @@ -build-essential -clang -cmake -curl -gettext -git -libicu-dev -libkrb5-dev -liblldb-dev -liblttng-ust-dev -libssl-dev -libunwind8-dev -lld -lldb -llvm -locales -ninja-build -python-is-python3 -zlib1g-dev \ No newline at end of file diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 63f1c9b25dafa5..5acbea2027c5ac 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -25,7 +25,8 @@ case "$os" in if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then apt update - xargs apt-get install -y < eng/debian-reqs.txt + apt-get install build-essential clang cmake curl gettext git libicu-dev libkrb5-dev liblldb-dev liblttng-ust-dev \ + libssl-dev libunwind8-dev lld lldb llvm locales ninja-build python-is-python3 zlib1g-dev localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 elif [ "$ID" = "alpine" ]; then From 725c4b7a3dc9b273fde3ea1426cc34b49d769081 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 14 May 2024 11:16:45 -0700 Subject: [PATCH 5/8] Revert "Respond to PR comments" This reverts commit ad5a56ff7437b41b1460790a84c6d2adb75e6c8b. --- eng/debian-reqs.txt | 19 +++++++++++++++++++ eng/install-native-dependencies.sh | 3 +-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 eng/debian-reqs.txt diff --git a/eng/debian-reqs.txt b/eng/debian-reqs.txt new file mode 100644 index 00000000000000..d549245657c9a7 --- /dev/null +++ b/eng/debian-reqs.txt @@ -0,0 +1,19 @@ +build-essential +clang +cmake +curl +gettext +git +libicu-dev +libkrb5-dev +liblldb-dev +liblttng-ust-dev +libssl-dev +libunwind8-dev +lld +lldb +llvm +locales +ninja-build +python-is-python3 +zlib1g-dev \ No newline at end of file diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 5acbea2027c5ac..63f1c9b25dafa5 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -25,8 +25,7 @@ case "$os" in if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then apt update - apt-get install build-essential clang cmake curl gettext git libicu-dev libkrb5-dev liblldb-dev liblttng-ust-dev \ - libssl-dev libunwind8-dev lld lldb llvm locales ninja-build python-is-python3 zlib1g-dev + xargs apt-get install -y < eng/debian-reqs.txt localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 elif [ "$ID" = "alpine" ]; then From 8d286b42ac004b2e86a83c67cba995168669ea52 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Wed, 15 May 2024 15:24:21 -0700 Subject: [PATCH 6/8] Respond to PR comments --- eng/native/build-commons.sh | 2 +- eng/native/gen-buildsys.sh | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index f16ca9ea05dee8..b4884c6f36fb1b 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -39,7 +39,7 @@ check_prereqs() # We try again with the PKG_CONFIG_PATH in place, if pkg-config still can't find OpenSSL, exit with an error, cmake won't find OpenSSL either pkg-config openssl || { echo >&2 "Please install openssl before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/macos-requirements.md"; exit 1; } fi - elif [[ "$__HostOS" == "linux" ]]; then + else # Check presence of cmake on the path command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; } fi diff --git a/eng/native/gen-buildsys.sh b/eng/native/gen-buildsys.sh index 4c1ed0943c45ac..c3143e08f9273b 100755 --- a/eng/native/gen-buildsys.sh +++ b/eng/native/gen-buildsys.sh @@ -84,11 +84,6 @@ if [[ "$host_arch" == "armel" ]]; then cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1" fi -if ! cmake_command=$(command -v cmake); then - echo "CMake was not found in PATH." - exit 1 -fi - if [[ "$scan_build" == "ON" && -n "$SCAN_BUILD_COMMAND" ]]; then cmake_command="$SCAN_BUILD_COMMAND $cmake_command" fi From eb71ca40b089b872360347a0344ed2c1ffb75b91 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Wed, 22 May 2024 15:30:05 -0700 Subject: [PATCH 7/8] Respond to PR comments --- eng/install-native-dependencies.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 63f1c9b25dafa5..b9d7eb666a4b89 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -9,6 +9,7 @@ set -e # ./install-native-dependencies.sh os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" +scriptroot="$(dirname "$0")" if [ -z "$os" ]; then # shellcheck source-path=SCRIPTDIR @@ -25,7 +26,7 @@ case "$os" in if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then apt update - xargs apt-get install -y < eng/debian-reqs.txt + xargs apt-get install -y < "$scriptroot/eng/debian-reqs.txt" localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 elif [ "$ID" = "alpine" ]; then @@ -43,7 +44,7 @@ case "$os" in export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 # brew update --preinstall - brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile" + brew bundle --no-upgrade --no-lock --file "$scriptroot/Brewfile" ;; *) From 04ca49f8d010afa8e60d4fe63c45a7c204dc2b49 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Mon, 8 Jul 2024 16:14:50 -0700 Subject: [PATCH 8/8] Typo --- eng/install-native-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index b9d7eb666a4b89..f34da2abda1c72 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -26,7 +26,7 @@ case "$os" in if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then apt update - xargs apt-get install -y < "$scriptroot/eng/debian-reqs.txt" + xargs apt-get install -y < "$scriptroot/debian-reqs.txt" localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 elif [ "$ID" = "alpine" ]; then