-
Notifications
You must be signed in to change notification settings - Fork 448
/
mapd-deps-ubuntu.sh
executable file
·356 lines (300 loc) · 7.64 KB
/
mapd-deps-ubuntu.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#!/usr/bin/env bash
set -e
set -x
# Parse inputs
TSAN=false
COMPRESS=false
NOCUDA=false
CACHE=
while (( $# )); do
case "$1" in
--compress)
COMPRESS=true
;;
--savespace)
SAVE_SPACE=true
;;
--tsan)
TSAN=true
;;
--nocuda)
NOCUDA=true
;;
--cache=*)
CACHE="${1#*=}"
;;
*)
break
;;
esac
shift
done
if [[ -n $CACHE && ( ! -d $CACHE || ! -w $CACHE ) ]]; then
# To prevent possible mistakes CACHE must be a writable directory
echo "Invalid cache argument [$CACHE] supplied. Ignoring."
CACHE=
fi
if [[ ! -x "$(command -v sudo)" ]] ; then
if [ "$EUID" -eq 0 ] ; then
yum install -y sudo
else
echo "ERROR - sudo not installed and not running as root"
exit
fi
fi
HTTP_DEPS="https://dependencies.mapd.com/thirdparty"
SUFFIX=${SUFFIX:=$(date +%Y%m%d)}
PREFIX=/usr/local/mapd-deps
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPTS_DIR/common-functions.sh
# Establish distro
source /etc/os-release
if [ "$ID" == "ubuntu" ] ; then
PACKAGER="apt -y"
if [ "$VERSION_ID" != "20.04" ] && [ "$VERSION_ID" != "19.10" ] && [ "$VERSION_ID" != "19.04" ] && [ "$VERSION_ID" != "18.04" ]; then
echo "Ubuntu 20.04, 19.10, 19.04, and 18.04 are the only debian-based releases supported by this script"
exit 1
fi
else
echo "Only Ubuntu is supported by this script"
exit 1
fi
sudo mkdir -p $PREFIX
sudo chown -R $(id -u) $PREFIX
# create a txt file in $PREFIX
# this should be based on the actual distro and arch, but they're the same files.
DEBIAN_FRONTEND=noninteractive sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
DEBIAN_FRONTEND=noninteractive sudo apt update
DEBIAN_FRONTEND=noninteractive sudo apt install -y \
software-properties-common \
build-essential \
ccache \
git \
wget \
curl \
libboost-all-dev \
libssl-dev \
libevent-dev \
default-jre \
default-jre-headless \
default-jdk \
default-jdk-headless \
libncurses5-dev \
libldap2-dev \
google-perftools \
libdouble-conversion-dev \
libevent-dev \
libgflags-dev \
libgoogle-perftools-dev \
libiberty-dev \
libjemalloc-dev \
libglu1-mesa-dev \
liblz4-dev \
liblzma-dev \
libbz2-dev \
libarchive-dev \
libcurl4-openssl-dev \
libedit-dev \
uuid-dev \
libsnappy-dev \
zlib1g-dev \
autoconf \
autoconf-archive \
automake \
bison \
flex \
libpng-dev \
rsync \
unzip \
jq \
python-dev \
python-yaml \
swig \
pkg-config \
libxerces-c-dev \
libxmlsec1-dev \
libtool \
patchelf \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev
# required for gcc-11 on Ubuntu < 22.04
if [ "$VERSION_ID" == "20.04" ] || [ "$VERSION_ID" == "19.04" ] || [ "$VERSION_ID" == "18.04" ]; then
DEBIAN_FRONTEND=noninteractive sudo add-apt-repository ppa:ubuntu-toolchain-r/test
fi
sudo $PACKAGER install \
gcc-11 \
g++-11
# Set up gcc-11 as default gcc
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-11 1100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-11
generate_deps_version_file
# Needed to find sqlite3, xmltooling, xml_security_c, and LLVM (for iwyu)
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PREFIX/lib64/pkgconfig:$PKG_CONFIG_PATH
export PATH=$PREFIX/bin:$PATH
if [ "$VERSION_ID" == "18.04" ]; then
# Required for TBB
download_make_install https://mirrors.sarata.com/gnu/binutils/binutils-2.32.tar.xz
else
DEBIAN_FRONTEND=noninteractive sudo apt install -y binutils-dev
fi
# mold fast linker
install_mold_precompiled_x86_64
install_ninja
install_maven
install_cmake
install_memkind
# llvm
# (see common-functions.sh)
LLVM_BUILD_DYLIB=true
install_llvm
# c-blosc
install_blosc
# Geo Support
install_gdal
install_geos
install_pdal
# install AWS core and s3 sdk
install_awscpp -j $(nproc)
# thrift
install_thrift
VERS=3.52.16
CFLAGS="-fPIC" CXXFLAGS="-fPIC" download_make_install ${HTTP_DEPS}/libiodbc-${VERS}.tar.gz
install_folly
install_iwyu
download_make_install ${HTTP_DEPS}/bisonpp-1.21-45.tar.gz bison++-1.21
# TBB
install_tbb
# OneDAL
install_onedal
# Apache Arrow (see common-functions.sh)
ARROW_BOOST_USE_SHARED="ON"
install_arrow
# Go
install_go
# librdkafka
install_rdkafka
# abseil
install_abseil
# glslang (with spirv-tools)
VERS=11.6.0 # stable 8/25/21
rm -rf glslang
mkdir -p glslang
pushd glslang
wget --continue https://github.com/KhronosGroup/glslang/archive/$VERS.tar.gz
tar xvf $VERS.tar.gz
pushd glslang-$VERS
./update_glslang_sources.py
mkdir build
pushd build
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
..
make -j $(nproc)
make install
popd # build
popd # glslang-$VERS
popd # glslang
# spirv-cross
VERS=2020-06-29 # latest from 6/29/20
rm -rf spirv-cross
mkdir -p spirv-cross
pushd spirv-cross
wget --continue https://github.com/KhronosGroup/SPIRV-Cross/archive/$VERS.tar.gz
tar xvf $VERS.tar.gz
pushd SPIRV-Cross-$VERS
mkdir build
pushd build
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_POSITION_INDEPENDENT_CODE=on \
-DSPIRV_CROSS_ENABLE_TESTS=off \
..
make -j $(nproc)
make install
popd # build
popd # SPIRV-Cross-$VERS
popd # spirv-cross
# Vulkan
install_vulkan
# GLM (GL Mathematics)
install_glm
# GLFW
VERS=3.3.6
download https://github.com/glfw/glfw/archive/refs/tags/${VERS}.tar.gz
extract ${VERS}.tar.gz
pushd glfw-${VERS}
mkdir -p build
pushd build
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBUILD_SHARED_LIBS=ON \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_DOCS=OFF \
..
make -j $(nproc)
make install
popd #build
popd #glfw
# ImGui
VERS=1.89.1-docking
rm -rf imgui
mkdir -p imgui
pushd imgui
wget --continue ${HTTP_DEPS}/imgui.$VERS.tar.gz
tar xvf imgui.$VERS.tar.gz
mkdir -p $PREFIX/include
mkdir -p $PREFIX/include/imgui
rsync -av imgui.$VERS/* $PREFIX/include/imgui
popd #imgui
# ImPlot
VERS=0.14
rm -rf implot
mkdir -p implot
pushd implot
wget --continue ${HTTP_DEPS}/implot.$VERS.tar.gz
tar xvf implot.$VERS.tar.gz
# Patch #includes for imgui.h / imgui_internal.h
pushd implot.$VERS
sudo patch -p0 < $SCRIPTS_DIR/implot-0.14_fix_imgui_includes.patch
popd
mkdir -p $PREFIX/include
mkdir -p $PREFIX/include/implot
rsync -av implot.$VERS/* $PREFIX/include/implot
popd #implot
# OpenSAML
download_make_install ${HTTP_DEPS}/xml-security-c-2.0.2.tar.gz "" "--without-xalan"
download_make_install ${HTTP_DEPS}/xmltooling-3.0.4-nolog4shib.tar.gz
CXXFLAGS="-std=c++14" download_make_install ${HTTP_DEPS}/opensaml-3.0.1-nolog4shib.tar.gz
cat > $PREFIX/mapd-deps.sh <<EOF
HEAVY_PREFIX=$PREFIX
LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH
LD_LIBRARY_PATH=\$HEAVY_PREFIX/lib:\$LD_LIBRARY_PATH
LD_LIBRARY_PATH=\$HEAVY_PREFIX/lib64:\$LD_LIBRARY_PATH
PATH=/usr/local/cuda/bin:\$PATH
PATH=\$HEAVY_PREFIX/go/bin:\$PATH
PATH=\$HEAVY_PREFIX/maven/bin:\$PATH
PATH=\$HEAVY_PREFIX/bin:\$PATH
VULKAN_SDK=\$HEAVY_PREFIX
VK_LAYER_PATH=\$HEAVY_PREFIX/etc/vulkan/explicit_layer.d
CMAKE_PREFIX_PATH=\$HEAVY_PREFIX:\$CMAKE_PREFIX_PATH
GOROOT=\$HEAVY_PREFIX/go
export LD_LIBRARY_PATH PATH VULKAN_SDK VK_LAYER_PATH CMAKE_PREFIX_PATH GOROOT
EOF
echo
echo "Done. Be sure to source the 'mapd-deps.sh' file to pick up the required environment variables:"
echo " source $PREFIX/mapd-deps.sh"
if [ "$COMPRESS" = "true" ] ; then
if [ "$TSAN" = "false" ]; then
TARBALL_TSAN=""
elif [ "$TSAN" = "true" ]; then
TARBALL_TSAN="tsan-"
fi
tar acvf mapd-deps-ubuntu-${VERSION_ID}-${TARBALL_TSAN}${SUFFIX}.tar.xz -C ${PREFIX} .
fi