Skip to content

Instantly share code, notes, and snippets.

@carpedm20
Last active August 29, 2015 14:07
Show Gist options
  • Save carpedm20/eabacce3ff37b35e04c5 to your computer and use it in GitHub Desktop.
Save carpedm20/eabacce3ff37b35e04c5 to your computer and use it in GitHub Desktop.
caffe (http://caffe.berkeleyvision.org/installation.html) install in local home directory
#!/bin/bash
PREFIX=/home/carpedm20/lib
## make !
{
## clean just incase
make clean -C .
## build
make -C .
}
## include
mkdir -p "${PREFIX}/include/leveldb"
cp ./include/leveldb/*.h "${PREFIX}/include/leveldb"
## lib - copy them all !
## @TODO - be OS specific
cp lib* "${PREFIX}/lib"
#########################################
# Yes... I know how miserable it is if you don't have a sudoer...
# sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
# sudo yum install gflags-devel glog-devel lmdb-devel
# by carpedm20
#########################################
mkdir $HOME/lib
mkdir $HOME/lib/lib
mkdir $HOME/git
#########################################
# Protocol Buffers - Google's data interchange format
# https://developers.google.com/protocol-buffers/
#########################################
cd $HOME/git
git clone https://github.com/google/protobuf.git
cd protobuf/
./autogen.sh
./configure --disable-shared --enable-static --prefix=$HOME/lib/
make
#make check
make install
#########################################
# LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
#########################################
cd $HOME/git
git clone https://github.com/google/leveldb.git
cd leveldb
wget https://gist.githubusercontent.com/carpedm20/eabacce3ff37b35e04c5/raw/cc87b72a5372f9f07ee4f9967e29e69d58ebb1c3/leveldb_install.sh
./leveldb_install.sh
#########################################
# A fast compressor/decompressor
# https://code.google.com/p/snappy/
#########################################
cd $HOME/git
git clone https://github.com/google/snappy.git
cd snappy
./autogetn.sh
./configure --disable-shared --enable-static --prefix=$HOME/lib/
make && make install
#########################################
# GCC (WTF...)
#########################################
cd $HOME/git
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
bunzip2 gmp-4.3.2.tar.bz2
tar xvf gmp-4.3.2.tar
cd gmp-4.3.2
./configure --disable-shared --enable-static --prefix=$HOME/lib
make && make check && make install
cd $HOME/git
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
bunzip2 mpfr-2.4.2.tar.bz2
tar xvf mpfr-2.4.2.tar
cd mpfr-2.4.2
./configure --disable-shared --enable-static --prefix=$HOME/lib --with-gmp=$HOME/lib
make && make check && make install
cd $HOME/git
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
tar zxvf mpc-0.8.1.tar.gz
cd mpc-0.8.1
./configure --disable-shared --enable-static --prefix=$HOME/lib --with-gmp=$HOME/lib --with-mpfr=$HOME/lib
make && make check && make install
cd $HOME/git
wget http://www.mr511.de/software/libelf-0.8.13.tar.gz
tar zxvf libelf-0.8.13.tar.gz
cd libelf-0.8.13
./configure --disable-shared --enable-static --prefix=$HOME/lib
make && make check && make install
cd $HOME/git
#git clone https://github.com/gcc-mirror/gcc.git # Too big Too slow Too gcc...
wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.gz
tar xzf gcc-4.8.2.tar.gz
cd gcc-4.8.2
./configure \
--disable-shared \
--disable-bootstrap \
--disable-libstdcxx-pch \
--enable-languages=all \
--enable-libgomp \
--enable-lto \
--enable-threads=posix \
--enable-tls \
--with-gmp=$HOME/lib/ \
--with-mpfr=$HOME/lib/ \
--with-mpc=$HOME/lib/ \
--with-libelf=/tmp/gcc \
--with-fpmath=sse \
--prefix=$HOME/lib/
make && make install
#########################################
# Open Source Computer Vision Library
# http://opencv.org
#########################################
cd $HOME/git
wget http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz
tar -zxvf cmake-3.0.2.tar.gz
cd cmake-3.0.2
./bootstrap --disable-shared --enable-static --prefix=$HOME/lib/
gmake && make install
cd $HOME/git
git clone https://github.com/Itseez/opencv.git
cd opencv/
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTA --disable-shared --enable-staticLL_PREFIX=$HOME/lib/ ..
make && make install
# glog
cd $HOME/git
wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz
tar zxvf glog-0.3.3.tar.gz
cd glog-0.3.3
./configure --disable-shared --enable-static --prefix=$HOME/lib/
make && make install
# gflags
cd $HOME/git
wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make && make install
# lmdb
cd $HOME/git
git clone git://gitorious.org/mdb/mdb.git
cd mdb/libraries/liblmdb
make && make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment