#install pre-requisites
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libgflags-dev  liblmdb-dev libhdf5-dev
sudo apt-get libgoogle-glog-dev (* raise error in caffe compilation. read inst-libgoogle-glog-dev)

-->Fix Issues  (to install caffe)

----> fix Google-glog-dev

it requires gcc-5 . if you downgrade it before. you have to upgared it again

#Edit /etc/apt/sources.list

sudo nano /etc/apt/sources.list

#remove # or add lines deb-src $url . $url = an esisting line

sudo apt-get update
apt-get source libgoogle-glog-dev
sudo apt-get install automake

#+As all other packages in ubuntu 15.10 is built with GCC 5(.2) but CUDA (7.5) not allow >4.9 gcc version!
#+We would like to "hack" CUDA to compile cuda files with gcc-5 as follows:

#sudo gedit /usr/local/cuda/include/host_config.h
#change line 113 to
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)

2. FIX google-glog
+Some bad guys build google-glog with wrong gcc abi config! And the wrong build is in
the official repository. Fack!
+i.e when all other package is built with -D_GLIBCXX_USE_CXX11_ABI=1 (default). They built it with
-D_GLIBCXX_USE_CXX11_ABI=0! We need to built it ourself!

sudo apt-get remove libgoogle-glog-dev libgoogle-glog0v5
cd ~ //other folder is ok
apt-get source libgoogle-glog-dev
cd google-glog-0.3.4

b) The generated makefile have some mistakes (?)
- change line 613 to ACLOCAL=aclocal-1.15
- change line 619 to AUTOMAKE=automake-1.15

make // this will have some errors, dont worry
automake --add-missing
make -j 16 //or 100,whatever
sudo make install

----> Fix HDF5 Problrm

# modify INCLUDE_DIRS in Makefile.config

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

# create symlinks as instructed here

cd /usr/lib/x86_64-linux-gnu
sudo ln -s
sudo ln -s

--> Compile it

cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired). do the following settings:
> USE_CUDNN := 1
> INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
> LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial /usr/local/share/OpenCV/3rdparty/lib/

make all
make test
make runtest
make pycaffe


: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'

add "opencv_imgcodecs" in Makefile.

(LIBRARIES += glog gflags protobuf leveldb snappy \
lmdb boost_system hdf5_hl hdf5 m \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs)






Tags: UBUNTU, GTX1080, UBUNTU16.04, caffe, deep_learning

Add comment

Security code

Free WordPress Themes - Download High-quality Templates