diff --git a/docs/workflow/requirements/linux-requirements.md b/docs/workflow/requirements/linux-requirements.md index 334e5e2ae354c..d0e0c48105fec 100644 --- a/docs/workflow/requirements/linux-requirements.md +++ b/docs/workflow/requirements/linux-requirements.md @@ -22,23 +22,15 @@ 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 ./eng/install-native-dependencies.sh +``` + +### 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. diff --git a/eng/debian-reqs.txt b/eng/debian-reqs.txt new file mode 100644 index 0000000000000..d549245657c9a --- /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 42a3727b3188a..f34da2abda1c7 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -9,22 +9,24 @@ set -e # ./install-native-dependencies.sh os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" +scriptroot="$(dirname "$0")" 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 < "$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 @@ -42,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" ;; *) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 2cf33442a9325..0b480ff5c9cba 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 + 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 if [[ "$__UseNinja" == 1 ]]; then diff --git a/eng/native/gen-buildsys.sh b/eng/native/gen-buildsys.sh index 4c1ed0943c45a..c3143e08f9273 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