Skip to content

Commit

Permalink
Add deps install script and remove testing deps from build dockerfile
Browse files Browse the repository at this point in the history
* Deps scripts - ubuntu prebuilt and centos prebuilt (formerly deploy.sh)

Add deps install script and remove testing deps from build dockerfile

Deps install script - change name and update readme/dockerfile

Deps compile ubuntu script - add compress option

Deps compile ubuntu script - correct tar output dir and update README

Deps compile ubuntu script - fix tar archive and make script executable

Deps compile ubuntu script - add enable flag, remove commented section

* Deps script - merge centos and ubuntu prebuilt scripts into one, update readme

* Dockerfile build update - reference new prebuilt script

* Update build dockerfile remove correctly named script

* Deps script - use latest gcc and g++ for ubuntu package deps
  • Loading branch information
mattdlh authored and andrewseidl committed Jan 29, 2019
1 parent ae88c48 commit 3a7f3ac
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 36 deletions.
51 changes: 18 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,35 +217,9 @@ Dependencies for `omnisci_web_server` and other Go utils are in [`ThirdParty/go`

MapD Core requires a number of dependencies which are not provided in the common CentOS/RHEL package repositories. A prebuilt package containing all these dependencies is provided for CentOS 7 (x86_64).

First install the basic build tools:

sudo yum groupinstall -y "Development Tools"
sudo yum install -y \
zlib-devel \
epel-release \
libssh \
openssl-devel \
ncurses-devel \
git \
maven \
java-1.8.0-openjdk-devel \
java-1.8.0-openjdk-headless \
gperftools \
gperftools-devel \
gperftools-libs \
python-devel \
wget \
curl \
environment-modules
sudo yum install -y \
jq

Next download and install the prebuilt dependencies:

curl -OJ https://dependencies.mapd.com/mapd-deps/deploy.sh
sudo bash deploy.sh

These dependencies will be installed to a directory under `/usr/local/mapd-deps`. The `deploy.sh` script also installs [Environment Modules](http://modules.sf.net) in order to simplify managing the required environment variables. Log out and log back in after running the `deploy.sh` script in order to active Environment Modules command, `module`.
Use the [scripts/mapd-deps-prebuilt.sh](scripts/mapd-deps-prebuilt.sh) build script to install prebuilt dependencies.

These dependencies will be installed to a directory under `/usr/local/mapd-deps`. The `mapd-deps-prebuilt.sh` script also installs [Environment Modules](http://modules.sf.net) in order to simplify managing the required environment variables. Log out and log back in after running the `mapd-deps-prebuilt.sh` script in order to active Environment Modules command, `module`.

The `mapd-deps` environment module is disabled by default. To activate for your current session, run:

Expand All @@ -271,7 +245,7 @@ Be sure to reboot after installing in order to activate the NVIDIA drivers.

### Environment Variables

The `deploy.sh` script includes two files with the appropriate environment variables: `mapd-deps-<date>.sh` (for sourcing from your shell config) and `mapd-deps-<date>.modulefile` (for use with [Environment Modules](http://modules.sf.net), yum package `environment-modules`). These files are placed in mapd-deps install directory, usually `/usr/local/mapd-deps/<date>`. Either of these may be used to configure your environment: the `.sh` may be sourced in your shell config; the `.modulefile` needs to be moved to the modulespath.
The `mapd-deps-prebuilt.sh` script includes two files with the appropriate environment variables: `mapd-deps-<date>.sh` (for sourcing from your shell config) and `mapd-deps-<date>.modulefile` (for use with [Environment Modules](http://modules.sf.net), yum package `environment-modules`). These files are placed in mapd-deps install directory, usually `/usr/local/mapd-deps/<date>`. Either of these may be used to configure your environment: the `.sh` may be sourced in your shell config; the `.modulefile` needs to be moved to the modulespath.

### Building Dependencies

Expand All @@ -295,15 +269,19 @@ The [scripts/mapd-deps-centos.sh](scripts/mapd-deps-centos.sh) script is used to

## Ubuntu

Most build dependencies required by MapD Core are available via APT. Certain dependencies such as Thrift, Blosc, and Folly must be built as they either do not exist in the default repositories or have outdated versions. The provided build script will install all required dependencies (except CUDA) and build the dependencies which require it. The built dependencies will be installed to `/usr/local/mapd-deps/` by default; see the Environment Variables section below for how to add these dependencies to your environment.
Most build dependencies required by MapD Core are available via APT. Certain dependencies such as Thrift, Blosc, and Folly must be built as they either do not exist in the default repositories or have outdated versions. A prebuilt package containing all these dependencies is provided for Ubuntu 18.04 (x86_64). The dependencies will be installed to `/usr/local/mapd-deps/` by default; see the Environment Variables section below for how to add these dependencies to your environment.

### Ubuntu 16.04

MapD Core requires a newer version of Boost than the version which is provided by Ubuntu 16.04. The [scripts/mapd-deps-ubuntu1604.sh](scripts/mapd-deps-ubuntu1604.sh) build script will compile and install a newer version of Boost into the `/usr/local/mapd-deps/` directory.

### Ubuntu 18.04

Use the [scripts/mapd-deps-ubuntu.sh](scripts/mapd-deps-ubuntu.sh) build script to install dependencies.
Use the [scripts/mapd-deps-prebuilt.sh](scripts/mapd-deps-prebuilt.sh) build script to install prebuilt dependencies.

These dependencies will be installed to a directory under `/usr/local/mapd-deps`. The `mapd-deps-prebuilt.sh` script above will generate a script named `mapd-deps.sh` containing the environment variables which need to be set. Simply source this file in your current session (or symlink it to `/etc/profile.d/mapd-deps.sh`) in order to activate it:

source /usr/local/mapd-deps/mapd-deps.sh

Some installs of Ubuntu 18.04 may fail while building with a message similar to:

Expand All @@ -316,7 +294,7 @@ This is a known issue in 18.04 which will be resolved in [Ubuntu 18.04.1](https:

### Environment Variables

The CUDA and mapd-deps `lib` directories need to be added to `LD_LIBRARY_PATH`; the CUDA and mapd-deps `bin` directories need to be added to `PATH`. The `mapd-deps-ubuntu.sh` script above will generate a script named `mapd-deps.sh` containing the environment variables which need to be set. Simply source this file in your current session (or symlink it to `/etc/profile.d/mapd-deps.sh`) in order to activate it:
The CUDA and mapd-deps `lib` directories need to be added to `LD_LIBRARY_PATH`; the CUDA and mapd-deps `bin` directories need to be added to `PATH`. The `mapd-deps-ubuntu.sh` and `mapd-deps-prebuilt.sh` scripts will generate a script named `mapd-deps.sh` containing the environment variables which need to be set. Simply source this file in your current session (or symlink it to `/etc/profile.d/mapd-deps.sh`) in order to activate it:

source /usr/local/mapd-deps/mapd-deps.sh

Expand All @@ -329,6 +307,13 @@ Recent versions of Ubuntu provide the NVIDIA CUDA Toolkit and drivers in the sta

Be sure to reboot after installing in order to activate the NVIDIA drivers.

### Building Dependencies

The [scripts/mapd-deps-ubuntu.sh](scripts/mapd-deps-ubuntu.sh) and [scripts/mapd-deps-ubuntu1604.sh](scripts/mapd-deps-ubuntu1604.sh) scripts are used to build the dependencies for Ubuntu 18.04 and 16.04, respectively. The scripts will install all required dependencies (except CUDA) and build the dependencies which require it. Modify this script and run if you would like to change dependency versions or to build on alternative CPU architectures.

cd scripts
./mapd-deps-ubuntu.sh --compress

## Arch

The following uses [yaourt](https://wiki.archlinux.org/index.php/Yaourt) to install packages from the [Arch User Repository](https://wiki.archlinux.org/index.php/Arch_User_Repository).
Expand Down
6 changes: 3 additions & 3 deletions docker/build/centos7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ RUN mkdir -p /usr/share/glvnd/egl_vendor.d && \
RUN mkdir -p /usr/local/share/glvnd/egl_vendor.d && \
echo '{ "file_format_version" : "1.0.0", "ICD" : { "library_path" : "libEGL_nvidia.so.0" } }' > /usr/local/share/glvnd/egl_vendor.d/10_nvidia.json

RUN curl -OJ https://internal-dependencies.mapd.com/mapd-deps/deploy.sh \
&& USER=root sudo bash ./deploy.sh --testing \
&& rm deploy.sh
RUN curl -OJ https://internal-dependencies.mapd.com/mapd-deps/mapd-deps-prebuilt.sh \
&& USER=root sudo bash ./mapd-deps-prebuilt.sh \
&& rm mapd-deps-prebuilt.sh
214 changes: 214 additions & 0 deletions scripts/mapd-deps-prebuilt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
#!/bin/bash

set -e
#set -x

PREFIX=/usr/local/mapd-deps

# Establish distro
if cat /etc/os-release | grep -i -q debian ; then
if cat /etc/os-release | grep VERSION_ID | grep -i -q 18.04 ; then
DISTRO="u18.04"
PACKAGER="apt -y"
else
echo "Ubuntu 18.04 is the only debian-based release supported by this script"
exit 1
fi
elif cat /etc/os-release | grep -i -q fedora ; then
if cat /etc/os-release | grep VERSION_ID | grep -i -q 7 ; then
DISTRO="c7"
MODPATH=/etc/modulefiles
PACKAGER="yum -y"
else
echo "CentOS 7 is the only fedora-based release supported by this script"
exit 1
fi
else
echo "Only debain- and fedora-based OSs are supported by this script"
exit 1
fi

# Establish file download tool
if hash wget 2>/dev/null; then
GETTER="wget --continue"
elif hash curl 2>/dev/null; then
GETTER="curl --continue - --remote-name --location"
else
GETTER="echo Please download: "
fi

# Parse inputs
FLAG=latest
ENABLE=false

while (( $# )); do
case "$1" in
--testing)
FLAG=testing
;;
--custom=*)
FLAG="${1#*=}"
;;
--enable)
ENABLE=true
;;
*)
break
;;
esac
shift
done

# Distro-specific installations
if [ "$DISTRO" = "u18.04" ] ; then
sudo $PACKAGER update
sudo $PACKAGER install \
build-essential \
ccache \
cmake \
cmake-curses-gui \
git \
wget \
curl \
clang \
llvm \
llvm-dev \
clang-format \
gcc \
g++ \
libboost-all-dev \
libgoogle-glog-dev \
golang \
libssl-dev \
libevent-dev \
default-jre \
default-jre-headless \
default-jdk \
default-jdk-headless \
maven \
libncurses5-dev \
libldap2-dev \
binutils-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 \
uuid-dev \
libsnappy-dev \
zlib1g-dev \
autoconf \
autoconf-archive \
automake \
bison \
flex-old \
libpng-dev \
rsync \
unzip \
jq \
python-yaml \
libxerces-c-dev \
libxmlsec1-dev

sudo mkdir -p $PREFIX
pushd $PREFIX
sudo $GETTER https://internal-dependencies.mapd.com/mapd-deps/mapd-deps-ubuntu-$FLAG.tar.xz
sudo tar xvf mapd-deps-ubuntu-$FLAG.tar.xz
sudo rm -f mapd-deps-ubuntu-$FLAG.tar.xz
popd

cat > $PREFIX/mapd-deps.sh <<EOF
PREFIX=$PREFIX
LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH
LD_LIBRARY_PATH=\$PREFIX/lib:\$LD_LIBRARY_PATH
LD_LIBRARY_PATH=\$PREFIX/lib64:\$LD_LIBRARY_PATH
PATH=/usr/local/cuda/bin:\$PATH
PATH=\$PREFIX/bin:\$PATH
VULKAN_SDK=\$PREFIX
VK_LAYER_PATH=\$PREFIX/etc/explicit_layer.d
CMAKE_PREFIX_PATH=\$PREFIX:\$CMAKE_PREFIX_PATH
export LD_LIBRARY_PATH PATH VULKAN_SDK VK_LAYER_PATH CMAKE_PREFIX_PATH
EOF

PROFPATH=/etc/profile.d/xx-mapd-deps.sh
if [ "$ENABLE" = true ] ; then
ln -sf $PREFIX/mapd-deps.sh $PROFPATH
echo "Done. A file at $PROFPATH has been created and will be run on startup"
echo "Source this file or reboot to load vars in this shell"
else
echo "Done. Be sure to source the 'mapd-deps.sh' file to pick up the required environment variables:"
echo " source $PREFIX/mapd-deps.sh"
fi
elif [ "$DISTRO" = "c7" ] ; then
sudo yum groupinstall -y "Development Tools"
sudo yum install -y \
zlib-devel \
epel-release \
libssh \
openssl-devel \
ncurses-devel \
git \
maven \
java-1.8.0-openjdk-devel \
java-1.8.0-openjdk-headless \
gperftools \
gperftools-devel \
gperftools-libs \
python-devel \
wget \
curl \
openldap-devel
sudo yum install -y \
jq

if ! type module >/dev/null 2>&1 ; then
sudo $PACKAGER install environment-modules
source /etc/profile
fi

sudo mkdir -p $PREFIX
pushd $PREFIX
sudo $GETTER https://internal-dependencies.mapd.com/mapd-deps/mapd-deps-$FLAG.tar.xz
DIRNAME=$(tar tf mapd-deps-$FLAG.tar.xz | head -n 2 | tail -n 1 | xargs dirname)
sudo tar xvf mapd-deps-$FLAG.tar.xz
sudo rm -f mapd-deps-$FLAG.tar.xz
MODFILE=$(readlink -e $(ls $DIRNAME/*modulefile | head -n 1))
popd

sudo mkdir -p $MODPATH/mapd-deps
sudo ln -sf $MODFILE $MODPATH/mapd-deps/$DIRNAME

if [ ! -e "$MODPATH/cuda" ]; then
pushd $MODPATH
sudo $GETTER https://internal-dependencies.mapd.com/mapd-deps/cuda
popd
fi

PROFPATH=/etc/profile.d/xx-mapd-deps.sh
if [ "$ENABLE" = true ] ; then
sudo echo 'module load cuda mapd-deps' > $PROFPATH
echo "Done. A file at $PROFPATH has been created and will be run on startup"
echo "Run 'source /etc/profile' or reboot to load mapd-deps and cuda module vars in this shell"
else
if [ ! -f "$PROFPATH" ] ; then
sudo echo '#module load cuda mapd-deps' > $PROFPATH
fi
echo "Done. Be sure to load modules function and load the mapd-deps and cuda modules to load variables:"
echo " source /etc/profile.d/modules.sh"
echo " module load cuda mapd-deps"
fi
source $PROFPATH
fi
5 changes: 5 additions & 0 deletions scripts/mapd-deps-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -x

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 )"
Expand Down Expand Up @@ -230,3 +231,7 @@ 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 [ "$1" = "--compress" ] ; then
tar acf mapd-deps-ubuntu-$SUFFIX.tar.xz -C $PREFIX .
fi

0 comments on commit 3a7f3ac

Please sign in to comment.