Skip to content

Commit 9c9c07c

Browse files
authored
Ease setup in Amazon Linux 2 (rust-lang#2833)
Adds a set of scripts to automate building and installing most dependencies in Amazon Linux 2 environments. This will make it easier to provide ARM64 binaries for Linux (see rust-lang#2805). The installation of dependencies isn't minimal but improves our situation w.r.t. AL2. Testing done manually on remote AL2 ARM64 instances, after running this I'm able to run the regression successfully. ### Callouts * Hasn't been tested on AL2 x86.
1 parent dd0379d commit 9c9c07c

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

scripts/setup/al2/install_cbmc.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# Copyright Kani Contributors
3+
# SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+
set -eu
6+
7+
# Source kani-dependencies to get CBMC_VERSION
8+
source kani-dependencies
9+
10+
if [ -z "${CBMC_VERSION:-}" ]; then
11+
echo "$0: Error: CBMC_VERSION is not specified"
12+
exit 1
13+
fi
14+
15+
# Binaries are not released for AL2, so build from source
16+
WORK_DIR=$(mktemp -d)
17+
git clone \
18+
--branch cbmc-${CBMC_VERSION} --depth 1 \
19+
https://github.com/diffblue/cbmc \
20+
"${WORK_DIR}"
21+
22+
pushd "${WORK_DIR}"
23+
24+
mkdir build
25+
git submodule update --init
26+
27+
cmake3 -S . -Bbuild -DWITH_JBMC=OFF -Dsat_impl="minisat2;cadical"
28+
cmake3 --build build -- -j$(nproc)
29+
sudo make -C build install
30+
31+
popd
32+
rm -rf "${WORK_DIR}"

scripts/setup/al2/install_deps.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# Copyright Kani Contributors
3+
# SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+
set -eu
6+
7+
# Dependencies.
8+
# Note: CMake 3.8 or higher is required to build CBMC, but those versions are
9+
# only available in AWS AMIs through `cmake3`. So we install `cmake3` and use it
10+
# to build CBMC.
11+
DEPS=(
12+
cmake
13+
cmake3
14+
git
15+
openssl-devel
16+
python3-pip
17+
wget
18+
)
19+
20+
set -x
21+
22+
sudo yum -y update
23+
sudo yum -y groupinstall "Development Tools"
24+
sudo yum -y install "${DEPS[@]}"
25+
26+
# Add Python package dependencies
27+
python3 -m pip install autopep8
28+
29+
# Get the directory containing this script
30+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
31+
32+
${SCRIPT_DIR}/install_cbmc.sh
33+
${SCRIPT_DIR}/install_viewer.sh
34+
# The Kissat installation script is platform-independent, so is placed one level up
35+
${SCRIPT_DIR}/../install_kissat.sh
36+
${SCRIPT_DIR}/../install_rustup.sh

scripts/setup/al2/install_viewer.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Copyright Kani Contributors
3+
# SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+
set -eu
6+
7+
# Install cbmc-viewer
8+
9+
# Source kani-dependencies to get CBMC_VIEWER_VERSION
10+
source kani-dependencies
11+
12+
if [ -z "${CBMC_VIEWER_VERSION:-}" ]; then
13+
echo "$0: Error: CBMC_VIEWER_VERSION is not specified"
14+
exit 1
15+
fi
16+
17+
set -x
18+
19+
python3 -m pip install cbmc-viewer==$CBMC_VIEWER_VERSION

0 commit comments

Comments
 (0)