1212# # g++ manually.
1313# #
1414# # Supported environments:
15- # # * Ubuntu (14.04, 16.04)
16- # # * Fedora
17- # # * OSX
15+ # # * Ubuntu (14.04, 16.04, 18.04)
16+ # # * macOS
17+ # #
18+ # # Update (2018-06-08):
19+ # # We are no longer able to support RedHat/Fedora because those
20+ # # environments are not supported by TensorFlow.
1821# # =================================================================
1922
2023set -o errexit
@@ -44,6 +47,9 @@ TF_TYPE="cpu"
4447function install_protobuf3.4.0() {
4548 # Install Relevant tooling
4649 # Remove any old versions of protobuf
50+ # Note: Protobuf 3.5+ PPA available Ubuntu Bionic(18.04) onwards - Should be used
51+ # when we retire 16.04 too: https://launchpad.net/~maarten-fonville/+archive/ubuntu/protobuf
52+ # This PPA unfortunately doesnt have Protobuf 3.5 for 16.04, but does for 14.04/18.04+
4753 DISTRIB=$1 # ubuntu/fedora
4854 if [ " $DISTRIB " == " ubuntu" ]; then
4955 sudo apt-get --yes --force-yes remove --purge libprotobuf-dev protobuf-compiler
@@ -60,7 +66,7 @@ function install_protobuf3.4.0() {
6066 wget -O protobuf-cpp-3.4.0.tar.gz https://github.com/google/protobuf/releases/download/v3.4.0/protobuf-cpp-3.4.0.tar.gz
6167 tar -xzf protobuf-cpp-3.4.0.tar.gz
6268 cd protobuf-3.4.0
63- ./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig
69+ ./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig || exit 1
6470 cd ..
6571 # Cleanup
6672 rm -rf protobuf-3.4.0 protobuf-cpp-3.4.0.tar.gz
@@ -106,6 +112,10 @@ if [ "$DISTRO" = "UBUNTU" ]; then
106112 LLVM_PKG_URL=" http://apt.llvm.org/artful/"
107113 LLVM_PKG_TARGET=" llvm-toolchain-artful main"
108114 fi
115+ if [ " $MAJOR_VER " == " 18" ]; then
116+ LLVM_PKG_URL=" http://apt.llvm.org/bionic/"
117+ LLVM_PKG_TARGET=" llvm-toolchain-bionic main"
118+ fi
109119
110120 if ! grep -q " deb $LLVM_PKG_URL $LLVM_PKG_TARGET " /etc/apt/sources.list; then
111121 echo -e " \n# Added by Peloton 'packages.sh' script on $( date) \ndeb $LLVM_PKG_URL $LLVM_PKG_TARGET " | sudo tee -a /etc/apt/sources.list > /dev/null
@@ -138,6 +148,12 @@ if [ "$DISTRO" = "UBUNTU" ]; then
138148 PKG_CLANG=" clang-3.8"
139149 TF_VERSION=" 1.5.0"
140150 fi
151+ # Fix for llvm on Ubuntu 18.x
152+ if [ " $MAJOR_VER " == " 18" ]; then
153+ PKG_LLVM=" llvm-3.9"
154+ PKG_CLANG=" clang-3.9"
155+ TF_VERSION=" 1.5.0"
156+ fi
141157 TFCApiFile=" libtensorflow-${TF_TYPE} -linux-x86_64-${TF_VERSION} .tar.gz"
142158 LinkerConfigCmd=" sudo ldconfig"
143159 sudo apt-get -q $FORCE_Y --ignore-missing -y install \
@@ -170,159 +186,15 @@ if [ "$DISTRO" = "UBUNTU" ]; then
170186 g++ \
171187 libeigen3-dev \
172188 ant \
173- unzip
189+ unzip \
190+ zlib1g-dev
174191 # Install version of protobuf needed by C-API
175192 install_protobuf3.4.0 " ubuntu"
176193 # Install tensorflow
177194 install_tf " $TFCApiFile " " $TF_VERSION " " $LinkerConfigCmd "
178195
179196# # ------------------------------------------------
180- # # DEBIAN
181- # # ------------------------------------------------
182- elif [ " $DISTRO " = " DEBIAN OS" ]; then
183- sudo apt-get -q --ignore-missing -y install \
184- git \
185- g++ \
186- clang \
187- cmake \
188- libgflags-dev \
189- libprotobuf-dev \
190- protobuf-compiler \
191- bison \
192- flex \
193- libevent-dev \
194- libboost-dev \
195- libboost-thread-dev \
196- libboost-filesystem-dev \
197- libjemalloc-dev \
198- libssl-dev \
199- valgrind \
200- lcov \
201- libpqxx-dev \
202- llvm-dev \
203- libedit-dev \
204- postgresql-client \
205- libtbb-dev \
206- libeigen3-dev
207-
208- # # ------------------------------------------------
209- # # FEDORA
210- # # ------------------------------------------------
211- elif [[ " $DISTRO " == * " FEDORA" * ]]; then
212- case $DISTRO_VER in
213- 26) LLVM=" llvm" ;;
214- * ) LLVM=" llvm4.0" ;;
215- esac
216- TF_VERSION=" 1.5.0"
217- TFCApiFile=" libtensorflow-${TF_TYPE} -linux-x86_64-${TF_VERSION} .tar.gz"
218- LinkerConfigCmd=" sudo ldconfig"
219- sudo dnf -q install -y \
220- git \
221- gcc-c++ \
222- make \
223- cmake \
224- gflags-devel \
225- bison \
226- flex \
227- libevent-devel \
228- openssl-devel \
229- boost-devel \
230- jemalloc-devel \
231- valgrind \
232- lcov \
233- libpqxx-devel \
234- libpqxx \
235- ${LLVM} \
236- ${LLVM} -devel \
237- ${LLVM} -static \
238- libedit-devel \
239- postgresql \
240- libasan \
241- libtsan \
242- libubsan \
243- libatomic \
244- tbb-devel \
245- python3-pip \
246- curl \
247- autoconf \
248- automake \
249- libtool
250- # Install version of protobuf needed by C-API
251- install_protobuf3.4.0 " fedora"
252- # Install tensorflow
253- install_tf " $TFCApiFile " " $TF_VERSION " " $LinkerConfigCmd "
254-
255- # # ------------------------------------------------
256- # # REDHAT
257- # # ------------------------------------------------
258- elif [[ " $DISTRO " == * " REDHAT" * ]] && [[ " ${DISTRO_VER% .* } " == " 7" ]]; then
259- function install_package() {
260- if [ " $# " -lt 1 ]; then
261- echo " The download path is required."
262- exit 1
263- fi
264-
265- pushd $TMPDIR
266- wget -nc --no-check-certificate " $1 "
267- tpath=$( basename " $1 " )
268- dpath=$( tar --exclude=' */*' -tf " $tpath " )
269- tar xzf $tpath
270- pushd $dpath
271- if [ -e " bootstrap.sh" ]; then
272- ./bootstrap.sh
273- sudo ./b2 install
274- else
275- ./configure
276- make
277- sudo make install
278- fi
279- popd ; popd
280- return 0
281- }
282-
283- # Package download paths
284- PKGS=(
285- " https://github.com/schuhschuh/gflags/archive/v2.0.tar.gz"
286- )
287- # Add EPEL repository first
288- sudo yum -q -y install epel-release
289- sudo yum -q -y upgrade epel-release
290-
291- # Simple installations via yum
292- sudo yum -q -y install \
293- git \
294- gcc-c++ \
295- make \
296- cmake3 \
297- flex \
298- bison \
299- libevent-devel \
300- openssl-devel \
301- boost-devel \
302- protobuf-devel \
303- jemalloc-devel \
304- libedit-devel \
305- valgrind \
306- lcov \
307- m4 \
308- doxygen \
309- graphviz \
310- libpqxx \
311- libpqxx-devel \
312- llvm3.9 \
313- llvm3.9-static \
314- llvm3.9-devel \
315- postgresql \
316- libtbb-dev
317-
318- # Manually download some packages to guarantee
319- # version compatibility
320- for pkg_path in ${PKGS[@]} ; do
321- install_package $pkg_path
322- done
323-
324- # # ------------------------------------------------
325- # # DARWIN (OSX)
197+ # # DARWIN (macOS)
326198# # ------------------------------------------------
327199elif [ " $DISTRO " = " DARWIN" ]; then
328200 set +o errexit
@@ -362,7 +234,7 @@ elif [ "$DISTRO" = "DARWIN" ]; then
362234# # UNKNOWN
363235# # ------------------------------------------------
364236else
365- echo " Unknown distribution '$DISTRO '"
237+ echo " Unsupported distribution '$DISTRO '"
366238 echo " Please contact our support team for additional help." \
367239 " Be sure to include the contents of this message"
368240 echo " Platform: $( uname -a) "
0 commit comments