From 3036346af67cc2575dd76537ff83db112936eb42 Mon Sep 17 00:00:00 2001 From: Jesse Hellemn Date: Thu, 15 Feb 2018 10:37:24 -0800 Subject: [PATCH] Trying a quick patch to install protobuf 2.6 Summary: Closes https://github.com/caffe2/caffe2/pull/1964 Reviewed By: orionr Differential Revision: D6994739 Pulled By: pjh5 fbshipit-source-id: dbef0c7e5b5ade1580effa463fe19f04b8a0a276 --- docker/jenkins/common/install_base.sh | 29 +++++++++++++++++++++++++-- docker/jenkins/ubuntu-cuda/Dockerfile | 1 + docker/jenkins/ubuntu/Dockerfile | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/docker/jenkins/common/install_base.sh b/docker/jenkins/common/install_base.sh index 93ccdb75a62..9edd1054ffc 100755 --- a/docker/jenkins/common/install_base.sh +++ b/docker/jenkins/common/install_base.sh @@ -2,6 +2,23 @@ set -ex +# This function installs protobuf 2.6 +install_protobuf_26() { + pb_dir="/usr/temp_pb_install_dir" + mkdir -p $pb_dir + + # On the nvidia/cuda:9-cudnn7-devel-centos7 image we need this symlink or + # else it will fail with + # g++: error: ./../lib64/crti.o: No such file or directory + ln -s /usr/lib64 "$pb_dir/lib64" + + curl -LO "https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz" + tar -xvz -C "$pb_dir" --strip-components 1 -f protobuf-2.6.1.tar.gz + pushd "$pb_dir" && ./configure && make && make check && sudo make install && sudo ldconfig + popd + rm -rf $pb_dir +} + install_ubuntu() { # Use AWS mirror if running in EC2 if [ -n "${EC2:-}" ]; then @@ -30,6 +47,12 @@ install_ubuntu() { protobuf-compiler \ sudo + # Ubuntu 14.04 ships with protobuf 2.5, but ONNX needs protobuf >= 2.6 + # so we install that here if on 14.04 + if [[ "$UBUNTU_VERSION" == 14.04 ]]; then + install_protobuf_26 + fi + # Cleanup apt-get autoclean && apt-get clean rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* @@ -62,11 +85,13 @@ install_centos() { lmdb-devel \ make \ opencv-devel \ - protobuf-c-compiler \ - protobuf-c-devel \ snappy-devel \ sudo + # Centos7 ships with protobuf 2.5, but ONNX needs protobuf >= 2.6 + # so we always install install that here + install_protobuf_26 + # Cleanup yum clean all rm -rf /var/cache/yum diff --git a/docker/jenkins/ubuntu-cuda/Dockerfile b/docker/jenkins/ubuntu-cuda/Dockerfile index 1a6ab1ddfb1..db3767593bc 100644 --- a/docker/jenkins/ubuntu-cuda/Dockerfile +++ b/docker/jenkins/ubuntu-cuda/Dockerfile @@ -5,6 +5,7 @@ FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu${UBUNTU_VERS # Install required packages to build Caffe2 ARG EC2 +ARG UBUNTU_VERSION ADD ./install_base.sh install_base.sh RUN bash ./install_base.sh && rm install_base.sh diff --git a/docker/jenkins/ubuntu/Dockerfile b/docker/jenkins/ubuntu/Dockerfile index cae60d96da9..843cb1b6781 100644 --- a/docker/jenkins/ubuntu/Dockerfile +++ b/docker/jenkins/ubuntu/Dockerfile @@ -3,6 +3,7 @@ FROM ubuntu:${UBUNTU_VERSION} # Install required packages to build Caffe2 ARG EC2 +ARG UBUNTU_VERSION ADD ./install_base.sh install_base.sh RUN bash ./install_base.sh && rm install_base.sh