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
This commit is contained in:
Jesse Hellemn 2018-02-15 10:37:24 -08:00 committed by Facebook Github Bot
parent 16cd3f4a9e
commit 3036346af6
3 changed files with 29 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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