diff --git a/diagnostics.yml b/diagnostics.yml index 6f6f5e6a96..9127a5f407 100644 --- a/diagnostics.yml +++ b/diagnostics.yml @@ -193,7 +193,7 @@ stages: parameters: name: Linux_cross osGroup: Linux - dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm-20220831130722-70ed2e8 + dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-20210719121212-8a8d3be crossrootfsDir: '/crossrootfs/arm' buildAndSkipTest: true strategy: @@ -207,7 +207,7 @@ stages: parameters: name: Linux_cross64 osGroup: Linux - dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm64-20220831130722-70ed2e8 + dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-20210719121212-8a8d3be crossrootfsDir: '/crossrootfs/arm64' buildAndSkipTest: true strategy: @@ -221,7 +221,7 @@ stages: parameters: name: Alpine_cross64 osGroup: Linux - dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm64-alpine-20220831130722-70ed2e8 + dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-alpine-20210923140502-78f7860 crossrootfsDir: '/crossrootfs/arm64' artifactsTargetPath: bin/Linux-musl.arm64.Release buildAndSkipTest: true @@ -281,9 +281,9 @@ stages: - template: /eng/build.yml parameters: - name: Ubuntu_18_04 + name: Ubuntu_16_04 osGroup: Linux - dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-3e800f1-20190508143252 + dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-09ca40b-20190520220842 dependsOn: CentOS_7 testOnly: true strategy: @@ -294,9 +294,9 @@ stages: - template: /eng/build.yml parameters: - name: Ubuntu_22_04 + name: Ubuntu_18_04 osGroup: Linux - dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-20220831130452-94fc78a + dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-3e800f1-20190508143252 dependsOn: CentOS_7 testOnly: true strategy: diff --git a/documentation/building/linux-instructions.md b/documentation/building/linux-instructions.md index 00370a0826..31e987c01f 100644 --- a/documentation/building/linux-instructions.md +++ b/documentation/building/linux-instructions.md @@ -1,4 +1,4 @@ -Linux Prerequisites +Linux Prerequisites =================== These instructions will lead you through preparing to build and test the diagnostics repo on Linux. We'll start by showing how to set up your environment from scratch. In some cases, a version lldb/llvm that works the best on the distro will have to be built and installed. @@ -6,53 +6,205 @@ These instructions will lead you through preparing to build and test the diagnos Toolchain Setup --------------- -SOS plugin requires lldb v3.9 and above. It is recommended to use latest version of llvm toolchain, but any version >= 3.9 should work. +The following instructions will install the required packages. This only needs to be done once per machine. These instructions assume that you already have "sudo" installed. It is also recommended to create a github fork of the diagnostics repo and cloning that instead of https://github.com/dotnet/diagnostics.git directly. To build or cross build for ARM on Windows or Linux see the instructions [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/cross-building.md#generating-the-rootfs) in the runtime repo. You will need to clone the runtime [repo](https://github.com/dotnet/runtime.git) and build the appropriate "rootfs" for arm or arm64 using these instructions. You only need to do this once. -Other prerequisites are: +#### Ubuntu 14.04 #### -* cmake -* python -* icu +In order to get clang-3.9, llvm-3.9 and lldb-3.9, we need to add additional package sources (see [http://llvm.org/apt/](http://llvm.org/apt/) for the other Ubuntu versions not listed here): -Examples --------- + sudo apt-get update + sudo apt-get install wget + echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main" | sudo tee /etc/apt/sources.list.d/llvm.list + echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list + wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update -Debian/Ubuntu: +Then install the required packages: -```sh -sudo apt install cmake clang curl gdb gettext git libicu-dev lldb liblldb-dev libunwind8 llvm make python python-lldb tar wget zip -``` + sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python python-lldb-3.9 tar zip -Alpine: +The lldb 3.9 package needs a lib file symbolic link fixed: -```sh -sudo apk add autoconf bash clang clang-dev cmake coreutils curl gcc gettext-dev git icu-dev krb5-dev libunwind-dev llvm make openssl openssl-dev python which -``` + cd /usr/lib/llvm-3.9/lib + sudo ln -s ../../x86_64-linux-gnu/liblldb-3.9.so.1 liblldb-3.9.so.1 -CentOS/Fedora/RHEL: +See the section below on how to clone, build and test the repo. -```sh -# on older OS versions, replace `dnf` with `yum` -sudo dnf install clang cmake openssl findutils gdb git libicu libunwind lldb-devel llvm-devel make python python2-lldb tar wget which zip -``` +#### Ubuntu 16.04 #### -OpenSuse: +Add the additional package sources: -```sh -sudo zypper install cmake gcc-c++ gdb git hostname libicu libunwind lldb-devel llvm-clang llvm-devel make python python-xml tar wget which zip -``` + sudo apt-get update + sudo apt-get install wget + echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial main" | sudo tee /etc/apt/sources.list.d/llvm.list + echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list + wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + +Then install the required packages: + + sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python python-lldb-3.9 tar zip + +The lldb 3.9 package needs a lib file symbolic link fixed: + + cd /usr/lib/llvm-3.9/lib + sudo ln -s ../../x86_64-linux-gnu/liblldb-3.9.so.1 liblldb-3.9.so.1 + +See the section below on how to clone, build and test the repo. + +#### Ubuntu 17.10 #### + +Add the additional package sources: + + sudo apt-get update + sudo apt-get install wget + echo "deb http://llvm.org/apt/artful/ llvm-toolchain-artful main" | sudo tee /etc/apt/sources.list.d/llvm.list + echo "deb http://llvm.org/apt/artful/ llvm-toolchain-artful-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list + wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + +Then install the required packages: + + sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python python-lldb-3.9 tar zip + +#### Ubuntu 18.04 #### + +Install the required packages: + + sudo apt-get update + sudo apt-get install cmake clang-3.9 curl gdb gettext git libicu-dev libssl1.0-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python-lldb-3.9 tar wget zip + +See the section below on how to clone, build and test the repo. + +#### Ubuntu 20.04 #### + +Install the required packages: + + sudo apt update + sudo apt install cmake clang curl gdb gettext git libicu-dev lldb liblldb-dev libunwind8 llvm make python python-lldb tar wget zip + +See the section below on how to clone, build and test the repo. +#### Alpine 3.8/3.9 #### + +Install the required packages: + + sudo apk add autoconf bash clang clang-dev cmake coreutils curl gcc gettext-dev git icu-dev krb5-dev libunwind-dev llvm make openssl openssl-dev python which + +#### CentOS 6 #### + +[TBD] + +#### CentOS 7 #### + +llvm, clang and lldb 3.9 will have to be built for this distro. + +First the prerequisites: + + sudo yum install centos-release-SCL epel-release + sudo yum install cmake cmake3 gcc gcc-c++ gdb git libicu libunwind make python27 tar wget which zip + +Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/centos7/build-install-lldb.sh). + +WARNING: this script installs llvm and lldb and may overwrite any previously installed versions. + + cd $HOME + git clone https://github.com/dotnet/diagnostics.git + $HOME/diagnostics/documentation/lldb/centos7/build-install-lldb.sh + +This will take some time to complete, but after it is finished all the required components will be built and installed. To build and test the repo: + + cd diagnostics + ./build.sh + ./test.sh + +#### Debian 8.2/8.7 #### + +In order to get lldb-5.0 (3.9 doesn't seem to work that well on 8.x), we need to add additional package sources: + + sudo apt-get update + sudo apt-get install wget + echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie main" | sudo tee /etc/apt/sources.list.d/llvm.list + echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-5.0 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list + wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + +Then install the packages you need: + + sudo apt-get install cmake clang-5.0 gdb gettext git libicu-dev liblldb-5.0-dev libunwind8 lldb-5.0 llvm make python-lldb-5.0 tar wget zip + +See the section below on how to clone, build and test the repo. Add "--clang5.0" to the ./build.sh command. + +#### Debian 9 (Stretch) #### + + sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev liblldb-3.9-dev libunwind8 lldb-3.9 llvm make python-lldb-3.9 tar wget zip + +See the section below on how to clone, build and test the repo. + +#### Fedora 24 #### + + sudo dnf install clang cmake findutils gdb git libicu libunwind make python tar wget which zip + +Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/fedora24/build-install-lldb.sh). + +WARNING: this script installs llvm and lldb and may overwrite any previously installed versions. + + cd $HOME + git clone https://github.com/dotnet/diagnostics.git + $HOME/diagnostics/documentation/lldb/fedora24/build-install-lldb.sh + +This will take some time to complete, but after it is finished all the required components will be built and installed. To build and test the repo: + + cd diagnostics + ./build.sh + ./test.sh + +#### Fedora 27, 28, 29 #### + + sudo dnf install clang cmake compat-openssl10 findutils gdb git libicu libunwind lldb-devel llvm-devel make python python2-lldb tar wget which zip + +See the section below on how to clone, build and test the repo. + +#### OpenSuse 42.1, 42.3 #### + + sudo zypper install cmake gcc-c++ gdb git hostname libicu libunwind lldb-devel llvm-clang llvm-devel make python python-xml tar wget which zip + ln -s /usr/bin/clang++ /usr/bin/clang++-3.5 + +Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/opensuse/build-install-lldb.sh). + +WARNING: this script installs llvm and lldb and may overwrite any previously installed versions. + + cd $HOME + git clone https://github.com/dotnet/diagnostics.git + $HOME/diagnostics/documentation/lldb/opensuse/build-install-lldb.sh + +This will take some time to complete, but after it is finished all the required components will be built and installed. To build and test the repo: + + cd diagnostics + ./build.sh + ./test.sh + +#### RHEL 7.5 #### + +[TBD] + +#### SLES #### + +[TBD] + +Set the maximum number of file-handles +-------------------------------------- + +To ensure that your system can allocate enough file-handles for the build run `sysctl fs.file-max`. If it is less than 100000, add `fs.file-max = 100000` to `/etc/sysctl.conf`, and then run `sudo sysctl -p`. Clone, build and test the repo ------------------------------ You now have all the required components. To clone, build and test the repo: -```sh -cd $HOME -git clone https://github.com/dotnet/diagnostics.git -cd diagnostics -./build.sh -./test.sh -``` + cd $HOME + git clone https://github.com/dotnet/diagnostics.git + cd diagnostics + ./build.sh + ./test.sh diff --git a/documentation/lldb/centos7/build-install-lldb.sh b/documentation/lldb/centos7/build-install-lldb.sh new file mode 100755 index 0000000000..7493a80589 --- /dev/null +++ b/documentation/lldb/centos7/build-install-lldb.sh @@ -0,0 +1,30 @@ +cd $HOME +wget http://ftp.gnu.org/gnu/binutils/binutils-2.29.1.tar.xz +wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/lldb-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/compiler-rt-3.9.1.src.tar.xz + +tar -xf binutils-2.29.1.tar.xz +tar -xf llvm-3.9.1.src.tar.xz +mkdir llvm-3.9.1.src/tools/clang +mkdir llvm-3.9.1.src/tools/lldb +mkdir llvm-3.9.1.src/projects/compiler-rt +tar -xf cfe-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/clang +tar -xf lldb-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/lldb +tar -xf compiler-rt-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/projects/compiler-rt +rm binutils-2.29.1.tar.xz +rm cfe-3.9.1.src.tar.xz +rm lldb-3.9.1.src.tar.xz +rm llvm-3.9.1.src.tar.xz +rm compiler-rt-3.9.1.src.tar.xz + +mkdir llvmbuild +cd llvmbuild +cmake3 -DCMAKE_BUILD_TYPE=Release -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=1 -DLLVM_BINUTILS_INCDIR=../binutils-2.29.1/include ../llvm-3.9.1.src +make -j $(($(getconf _NPROCESSORS_ONLN)+1)) +sudo make install +cd .. +rm -r llvmbuild +rm -r llvm-3.9.1.src +rm -r binutils-2.29.1 diff --git a/documentation/lldb/fedora24/build-install-lldb.sh b/documentation/lldb/fedora24/build-install-lldb.sh new file mode 100755 index 0000000000..456277aa2f --- /dev/null +++ b/documentation/lldb/fedora24/build-install-lldb.sh @@ -0,0 +1,23 @@ +cd $HOME +wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/lldb-3.9.1.src.tar.xz + +tar -xf llvm-3.9.1.src.tar.xz +mkdir llvm-3.9.1.src/tools/clang +mkdir llvm-3.9.1.src/tools/lldb +tar -xf cfe-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/clang +tar -xf lldb-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/lldb +rm cfe-3.9.1.src.tar.xz +rm lldb-3.9.1.src.tar.xz +rm llvm-3.9.1.src.tar.xz + +mkdir llvmbuild +cd llvmbuild +cmake -DCMAKE_BUILD_TYPE=Release -DLLDB_DISABLE_CURSES=1 -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=1 -DLLVM_BUILD_DOCS=0 ../llvm-3.9.1.src + +make -j $(($(getconf _NPROCESSORS_ONLN)+1)) +sudo make install +cd .. +rm -r llvmbuild +rm -r llvm-3.9.1.src diff --git a/documentation/lldb/opensuse/build-install-lldb.sh b/documentation/lldb/opensuse/build-install-lldb.sh new file mode 100755 index 0000000000..b9135b8999 --- /dev/null +++ b/documentation/lldb/opensuse/build-install-lldb.sh @@ -0,0 +1,28 @@ +cd $HOME + +wget http://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.tar.gz +wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz +wget http://releases.llvm.org/3.9.1/lldb-3.9.1.src.tar.xz + +tar -xf cmake-3.11.4-Linux-x86_64.tar.gz +tar -xf llvm-3.9.1.src.tar.xz +mkdir llvm-3.9.1.src/tools/clang +mkdir llvm-3.9.1.src/tools/lldb +tar -xf cfe-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/clang +tar -xf lldb-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/lldb +rm cmake-3.11.4-Linux-x86_64.tar.gz +rm cfe-3.9.1.src.tar.xz +rm lldb-3.9.1.src.tar.xz +rm llvm-3.9.1.src.tar.xz + +mkdir llvmbuild +cd llvmbuild +../cmake-3.11.4-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=Release -DLLDB_DISABLE_CURSES=1 -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=1 -DLLVM_BUILD_DOCS=0 ../llvm-3.9.1.src + +make -j $(($(getconf _NPROCESSORS_ONLN)+1)) +sudo make install +cd .. +rm -r llvmbuild +rm -r llvm-3.9.1.src +rm -r cmake-3.11.4-Linux-x86_64