Skip to content

Commit

Permalink
Created dockerfile and successfully built a docker image for phasar
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbs committed Oct 1, 2019
1 parent 59c7a31 commit 55c8fcc
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
./docker
./docker
./build
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:latest

LABEL Name=phasar Version=1.0.0

RUN apt-get -y update && apt-get install -y

SHELL ["/bin/bash", "-c"]
RUN apt-get install bash sudo -y
ADD ./InitializeEnvironment.sh /usr/src/phasar/
ADD ./InstallAptDependencies.sh /usr/src/phasar/
RUN sudo apt-get install libz3-4 z3 -y

WORKDIR /usr/src/phasar
RUN ./InitializeEnvironment.sh
RUN ./InstallAptDependencies.sh
RUN sudo apt-get install libboost-all-dev -y

COPY . /usr/src/phasar

RUN ./bootstrap_docker.sh

ENTRYPOINT [ "./build/phasar" ]
7 changes: 7 additions & 0 deletions InitializeEnvironment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# copied from "https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive"
export DEBIAN_FRONTEND=noninteractive

ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
apt-get install -y tzdata
dpkg-reconfigure --frontend noninteractive tzdata
9 changes: 9 additions & 0 deletions InstallAptDependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

#sudo apt-get update
sudo apt-get install git make cmake -y
#echo "-------------------------------------------"
#git --version
#echo "-------------------------------------------"
sudo apt-get install zlib1g-dev sqlite3 libsqlite3-dev libmysqlcppconn-dev bear python3 doxygen graphviz python python-dev python3-pip python-pip libxml2 libxml2-dev libncurses5-dev libncursesw5-dev swig build-essential g++ cmake libz3-dev libedit-dev python-sphinx libomp-dev libcurl4-openssl-dev -y
27 changes: 27 additions & 0 deletions InstallLLVM.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
set -e

NUM_THREADS=$(nproc)


sudo pip install Pygments
sudo pip install pyyaml
sudo apt-get install libboost-all-dev

#verify installation
BOOST_VERSION=$(echo -e '#include <boost/version.hpp>\nBOOST_LIB_VERSION' | gcc -s -x c++ -E - 2>/dev/null| grep "^[^#;]" | tr -d '\"')
if [ -z $BOOST_VERSION ] ;then
echo "Failed installing boost $DESIRED_BOOST_VERSION"
exit 1
else
echo "Successfully installed boost v${BOOST_VERSION//_/.}"
fi




# installing LLVM
./utils/install-llvm-8.0.0.sh $NUM_THREADS ./utils/
# installing wllvm
sudo pip3 install wllvm

echo "dependencies successfully installed"
3 changes: 3 additions & 0 deletions TestScript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo "Hello, World"
7 changes: 4 additions & 3 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set -- "${POSITIONAL[@]}" # restore positional parameters
echo "installing phasar dependencies..."

sudo apt-get update
sudo apt-get install zlib1g-dev sqlite3 libsqlite3-dev libmysqlcppconn-dev bear python3 doxygen graphviz python python-dev python3-pip libxml2 libxml2-dev libncurses5-dev libncursesw5-dev swig build-essential g++ cmake libz3 libz3-dev libedit-dev python-sphinx libomp-dev libcurl4-openssl-dev
sudo apt-get install zlib1g-dev sqlite3 libsqlite3-dev libmysqlcppconn-dev bear python3 doxygen graphviz python python-dev python3-pip python-pip libxml2 libxml2-dev libncurses5-dev libncursesw5-dev swig build-essential g++ cmake libz3-dev libedit-dev python-sphinx libomp-dev libcurl4-openssl-dev -y
sudo pip install Pygments
sudo pip install pyyaml
# installing boost
Expand All @@ -59,10 +59,10 @@ BOOST_VERSION=$(echo -e '#include <boost/version.hpp>\nBOOST_LIB_VERSION' | gcc

if [ -z $BOOST_VERSION ] ;then
if [ -z $DESIRED_BOOST_VERSION ] ;then
sudo apt-get install libboost-all-dev
sudo apt-get install libboost-all-dev -y
else
# DESIRED_BOOST_VERSION in form d.d, i.e. 1.65 (this is the latest version I found in the apt repo)
sudo apt-get install "libboost${DESIRED_BOOST_VERSION}-all-dev"
sudo apt-get install "libboost${DESIRED_BOOST_VERSION}-all-dev" -y
fi
#verify installation
BOOST_VERSION=$(echo -e '#include <boost/version.hpp>\nBOOST_LIB_VERSION' | gcc -s -x c++ -E - 2>/dev/null| grep "^[^#;]" | tr -d '\"')
Expand Down Expand Up @@ -99,5 +99,6 @@ make -j $NUM_THREADS
echo "phasar successfully built"
echo "install phasar..."
sudo make install
sudo ldconfig
cd ..
echo "phasar successfully installed"
41 changes: 41 additions & 0 deletions bootstrap_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
set -e

NUM_THREADS=$(nproc)


sudo pip install Pygments
sudo pip install pyyaml
# installing boost
#wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
#tar xvf boost_1_66_0.tar.gz
#cd boost_1_66_0/
#./bootstrap.sh
#sudo ./b2 install
#cd ..


# installing LLVM
./utils/install-llvm-8.0.0.sh $NUM_THREADS ./utils/
# installing wllvm
sudo pip3 install wllvm

echo "dependencies successfully installed"
echo "build phasar..."

#git submodule init
#git submodule update

export CC=/usr/local/bin/clang
export CXX=/usr/local/bin/clang++

mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $NUM_THREADS
echo "phasar successfully built"
echo "install phasar..."
sudo make install
sudo ldconfig
cd ..
echo "phasar successfully installed"
8 changes: 8 additions & 0 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '2.1'

services:
phasar:
image: phasar
build:
context: .
dockerfile: Dockerfile
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '2.1'

services:
phasar:
image: phasar
build: .
17 changes: 12 additions & 5 deletions utils/install-llvm-8.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,28 @@ num_cores=1
target_dir=./
re_number="^[0-9]+$"

if [ "$#" -ne 2 ] || ! [[ "$1" =~ ${re_number} ]] || ! [ -d "$2" ]; then
echo "usage: <prog> <# cores> <directory>" >&2
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ] || ! [[ "$1" =~ ${re_number} ]] || ! [ -d "$2" ] || ! [ -z "$3"] && [ "$3" -ne "-checkout" ] ; then
echo "usage: <prog> <# cores> <directory> [-checkout]" >&2
exit 1
fi

num_cores=$1
target_dir=$2

echo "Getting the complete LLVM source code"



if [ ! -d "${target_dir}/llvm-project" ]; then
echo "Getting the complete LLVM source code"
git clone https://github.com/llvm/llvm-project.git ${target_dir}/llvm-project
git checkout llvmorg-8.0.0
elif ["$3" -eq "-checkout"]; then
git checkout llvmorg-8.0.0
fi
echo "Build the LLVM project"

cd ${target_dir}/llvm-project/
git checkout llvmorg-8.0.0

echo "Build the LLVM project"
mkdir -p build
cd build
cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lld;lldb;compiler-rt;lld;polly;debuginfo-tests;openmp;parallel-libs' -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_CXX1Y=ON -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=ON ../llvm
Expand Down

0 comments on commit 55c8fcc

Please sign in to comment.