-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-reanimator-lttng.sh
executable file
·215 lines (194 loc) · 6.33 KB
/
build-reanimator-lttng.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
#
# Description: Install script for reanimator-lttng and dependencies
# Authors: Thomas Fleming, Lukas Velikov
####################
# Script variables #
####################
readonly programDependencies=("asciidoc" "autoconf" "automake" "bison" "cmake" "flex" "git" "make" "perl")
readonly numberOfCores="$(nproc --all)"
configArgs=""
install=false
installDir="/usr/local"
installPackages=false
missingPrograms=()
repositoryDir="$(pwd)/build"
####################
# Script functions #
####################
# Wrapper function for running commands with feedback
function runcmd
{
echo "CMD: $*"
sleep 0.2
"$@"
ret=$?
if test $ret -ne 0 ; then
exit $ret
fi
}
# Output usage string (invoked on -h or --help)
function printUsage
{
(
cat << EOF
Usage: $0 [options...]
Options:
--config-args ARGS Append ARGS to every ./configure command
--install-packages Automatically use apt-get to install missing packages
-h, --help Print this help message
EOF
) >&2
exit 0
}
##################
# Script startup #
##################
# Parse script arguments
while [[ $# -gt 0 ]]; do
key="$1"
case "${key}" in
--config-args)
shift # past argument
"${configArgs}"="$1"
shift # past value
;;
--install-packages)
if command -v apt-get >/dev/null; then
installPackages=true
else
echo "Could not find apt-get. Missing packages must be \
installed manually." >&2
fi
shift # past argument
;;
-h|--help)
printUsage
shift # past argument
;;
*)
shift # past argument
;;
esac
done
# See if sudo is installed
if ! command -v sudo &>/dev/null; then
echo "Script could not find 'sudo' command. Cannot install." >&2
exit 1
fi
# Check whether program dependencies are installed
for program in "${programDependencies[@]}"; do
programPath=$(command -v "${program}")
if [[ $? == 0 ]]; then
echo "${program}: Located at ${programPath}"
elif [[ "${installPackages}" == true ]]; then
echo "${program}: Not found. Queuing for installation..."
missingPrograms+=("${program}")
else
echo "${program}: Not found."
missingPrograms+=("${program}")
fi
done
# Check whether the user has all required programs for building
if [[ "${#missingPrograms[@]}" -gt 0 ]]; then
if [[ "${installPackages}" == true ]]; then
echo "Installing missing programs."
runcmd sudo apt-get install -y "${missingPrograms[@]}"
else
echo "Could not find all required programs. Not found:"
for program in "${missingPrograms[@]}"; do
echo " ${program}"
done
echo "To install on a Debian-based system, run the command"
echo " sudo apt-get install ${missingPrograms[*]}"
exit 1
fi
fi
# Clone repositories
runcmd mkdir -p "${repositoryDir}"
runcmd cd "${repositoryDir}"
[[ -d "reanimator-userspace-rcu" ]] || runcmd git clone https://github.com/SNIA/reanimator-userspace-rcu.git
[[ -d "reanimator-lttng-ust" ]] || runcmd git clone https://github.com/SNIA/reanimator-lttng-ust.git
[[ -d "reanimator-lttng-tools" ]] || runcmd git clone https://github.com/SNIA/reanimator-lttng-tools.git
[[ -d "reanimator-lttng-modules" ]] || runcmd git clone https://github.com/SNIA/reanimator-lttng-modules.git
[[ -d "reanimator-babeltrace" ]] || runcmd git clone https://github.com/SNIA/reanimator-babeltrace.git
[[ -d "reanimator-library" ]] || runcmd git clone https://github.com/SNIA/reanimator-library.git
[[ -d "reanimator-replayer" ]] || runcmd git clone https://github.com/SNIA/reanimator-replayer.git
[[ -d "oneTBB" ]] || runcmd git clone https://github.com/oneapi-src/oneTBB.git
# Build reanimator-userspace-rcu
runcmd cd reanimator-userspace-rcu
runcmd ./bootstrap
runcmd ./configure "${configArgs}"
runcmd make -j"${numberOfCores}"
runcmd sudo make -j"${numberOfCores}" install
runcmd sudo ldconfig
runcmd cd "${repositoryDir}"
# Build reanimator-lttng-ust
runcmd cd reanimator-lttng-ust
runcmd ./bootstrap
runcmd ./configure "${configArgs}"
runcmd make -j"${numberOfCores}"
runcmd sudo make -j"${numberOfCores}" install
runcmd sudo ldconfig
runcmd cd "${repositoryDir}"
# Build reanimator-lttng-tools
runcmd cd reanimator-lttng-tools
runcmd git checkout ds
runcmd ./bootstrap
runcmd ./configure "${configArgs}"
rumcmd make -j"${numberOfCores}"
runcmd sudo make -j"${numberOfCores}" install
runcmd sudo ldconfig
runcmd cd "${repositoryDir}"
# Build reanimator-lttng-modules
# Exhausts memory at 1 GiB memory, so try to have more
# Requires Reanimator fsl-lttng-linux kernel
runcmd cd reanimator-lttng-modules
ubuntu_version=$(lsb_release -d | awk '{print $3}')
echo $ubuntu_version
if [[ "${ubuntu_version}" == "18.04.3" ]]; then
runcmd git checkout u18-changes # u18 support
else
runcmd git checkout ds
fi
runcmd make -j"${numberOfCores}"
runcmd sudo make -j"${numberOfCores}" modules_install
runcmd sudo depmod -a
runcmd cd "${repositoryDir}"
# Build reanimator-library
runcmd cd reanimator-library
runcmd chmod +x build-reanimator-library.sh
runcmd ./build-reanimator-library.sh --install
runcmd cd "${repositoryDir}"
# Build TBB
runcmd cd oneTBB
runcmd git fetch --all --tags --prune
runcmd git checkout tags/v2020.3
runcmd sudo cp -r ./include/. "${installDir}/include"
runcmd sudo make tbb_build_dir="${installDir}/lib" tbb_build_prefix=one_tbb -j"${numberOfCores}"
runcmd sudo cp /usr/local/lib/one_tbb_release/*.so* /usr/local/lib
runcmd cd "${repositoryDir}"
# Build reanimator-replayer
runcmd cd reanimator-replayer
runcmd rm -rf build
runcmd mkdir build
runcmd cd build
runcmd cmake ..
runcmd make -j"${numberOfCores}"
runcmd cd "${repositoryDir}"
# Build reanimator-babeltrace
runcmd cd reanimator-babeltrace
runcmd git checkout ds
runcmd ./bootstrap
runcmd sed -i 's/O2/O0/g' configure # U18 O2 Hotfix
runcmd ./configure "${configArgs}"
runcmd make -j"${numberOfCores}"
runcmd sudo make -j"${numberOfCores}" install
runcmd sudo ldconfig
runcmd cd "${repositoryDir}"
# Build reanimator-lttng
runcmd sudo mkdir -p /usr/local/strace2ds/tables/
runcmd sudo cp "${repositoryDir}"/../syscalls_name_number.table /usr/local/strace2ds/tables/
runcmd cd "${repositoryDir}"
runcmd cmake ..
runcmd make -j"${numberOfCores}"