Skip to content

Commit 55747a5

Browse files
authored
Add more complete linux build instructions (#101631)
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.
1 parent cf08d43 commit 55747a5

File tree

5 files changed

+36
-25
lines changed

5 files changed

+36
-25
lines changed

docs/workflow/requirements/linux-requirements.md

+9-17
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,15 @@ Minimum RAM required to build is 1GB. The build is known to fail on 512 MB VMs (
2222

2323
### Toolchain Setup
2424

25-
Install the following packages for the toolchain:
26-
27-
* CMake 3.20 or newer
28-
* llvm
29-
* lld
30-
* clang
31-
* build-essential
32-
* python-is-python3
33-
* curl
34-
* git
35-
* lldb
36-
* libicu-dev
37-
* liblttng-ust-dev
38-
* libssl-dev
39-
* libkrb5-dev
40-
* zlib1g-dev
41-
* ninja-build (optional, enables building native code with ninja instead of make)
25+
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).
26+
27+
You can install all the above dependencies by running
28+
29+
```bash
30+
sudo ./eng/install-native-dependencies.sh
31+
```
32+
33+
### Community-supported environments
4234

4335
**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.
4436

eng/debian-reqs.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
build-essential
2+
clang
3+
cmake
4+
curl
5+
gettext
6+
git
7+
libicu-dev
8+
libkrb5-dev
9+
liblldb-dev
10+
liblttng-ust-dev
11+
libssl-dev
12+
libunwind8-dev
13+
lld
14+
lldb
15+
llvm
16+
locales
17+
ninja-build
18+
python-is-python3
19+
zlib1g-dev

eng/install-native-dependencies.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ set -e
99
# ./install-native-dependencies.sh <OS>
1010

1111
os="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
12+
scriptroot="$(dirname "$0")"
1213

1314
if [ -z "$os" ]; then
15+
# shellcheck source-path=SCRIPTDIR
1416
. "$(dirname "$0")"/common/native/init-os-and-arch.sh
1517
fi
1618

1719
case "$os" in
1820
linux)
1921
if [ -e /etc/os-release ]; then
22+
# shellcheck source=/dev/null
2023
. /etc/os-release
2124
fi
2225

2326
if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then
2427
apt update
2528

26-
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
27-
libssl-dev libkrb5-dev zlib1g-dev
29+
xargs apt-get install -y < "$scriptroot/debian-reqs.txt"
2830

2931
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
3032
elif [ "$ID" = "alpine" ]; then
@@ -42,7 +44,7 @@ case "$os" in
4244
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
4345
# Skip brew update for now, see https://github.com/actions/setup-python/issues/577
4446
# brew update --preinstall
45-
brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile"
47+
brew bundle --no-upgrade --no-lock --file "$scriptroot/Brewfile"
4648
;;
4749

4850
*)

eng/native/build-commons.sh

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ check_prereqs()
3939
# 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
4040
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; }
4141
fi
42+
else
43+
# Check presence of cmake on the path
44+
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; }
4245
fi
4346

4447
if [[ "$__UseNinja" == 1 ]]; then

eng/native/gen-buildsys.sh

-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ if [[ "$host_arch" == "armel" ]]; then
8484
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
8585
fi
8686

87-
if ! cmake_command=$(command -v cmake); then
88-
echo "CMake was not found in PATH."
89-
exit 1
90-
fi
91-
9287
if [[ "$scan_build" == "ON" && -n "$SCAN_BUILD_COMMAND" ]]; then
9388
cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
9489
fi

0 commit comments

Comments
 (0)