Last active
August 29, 2015 14:18
-
-
Save ilyakava/6f22d458b9771e7ccc97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On: Ubuntu 14.10 (Utopic Unicorn), used with opencv 2.4.11 and cuda-7.0 for Quadro NVS 510 | |
# Also successfuly tested On: Ubuntu 14.10 (Utopic Unicorn), used with opencv 3.0.0 and cuda-7.0 for Tesla K40c | |
set -o errexit | |
echo "Removing any pre-installed ffmpeg and x264" | |
sudo apt-get -qq remove ffmpeg x264 libx264-dev libavcodec-dev libavformat-dev libavdevice-dev libavutil-dev | |
echo "Installing ffmpeg from source" | |
sudo apt-get -qq install git | |
git clone git://source.ffmpeg.org/ffmpeg.git | |
cd ffmpeg | |
./configure --enable-shared --disable-static | |
make | |
sudo make install | |
cd .. | |
echo "Installing Dependenices" | |
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libswscale-dev libdc1394-22-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils cmake qt5-default checkinstall | |
# additional packages (installed in desperation, not sure if all are necessary): | |
sudo apt-get -qq install ia32-libs lib32stdc++6 clang-3.5 | |
# necessary symlinks | |
sudo ln -s /usr/bin/clang-3.5 /usr/bin/clang | |
sudo ln -s /usr/bin/clang++-3.5 /usr/bin/clang++ | |
version="$(wget -q -O - http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep -m1 -o '\"[0-9](\.[0-9]+)+' | cut -c2-)" | |
echo "Installing OpenCV" $version | |
mkdir OpenCV | |
cd OpenCV | |
echo "Downloading OpenCV" $version | |
wget -O OpenCV-$version.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/opencv-"$version".zip/download | |
echo "Installing OpenCV" $version | |
unzip OpenCV-$version.zip | |
cd opencv-$version | |
mkdir build | |
cd build | |
cmake -D WITH_CUDA=ON -D CUDA_GENERATION=Kepler -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON .. | |
make -j2 | |
sudo checkinstall | |
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' | |
sudo ldconfig | |
echo "Setting up OpenCV" $version | |
sudo ln -s /usr/local/cuda/lib64/libcufft.so /usr/local/lib/ | |
sudo ln -s /usr/local/cuda/lib64/libnpps.so /usr/local/lib/ | |
sudo ln -s /usr/local/cuda/lib64/libnppi.so /usr/local/lib/ | |
sudo ln -s /usr/local/cuda/lib64/libnppc.so /usr/local/lib/ | |
sudo ln -s /usr/local/cuda/lib64/libcudart.so /usr/local/lib/ | |
sudo cp unix-install/opencv.pc /usr/local/lib/pkgconfig/ | |
sudo sh -c 'echo "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" >> ~/.bashrc' | |
source ~/.bashrc | |
echo "OpenCV" $version "ready to be used" |
note that with cuda-7.0 we no longer have to build with libstdc++ as requested for the udacity course,
see the comment after this question.
In fact, since -DCMAKE_CXX_FLAGS:STRING='-stdlib=libstdc++'
is a clang
param, and b/c of this line in opencv
it seems that it was not even possible to build opencv with cuda versions earlier than 7.0 on ubuntu with libstdc++
btw, needed to add deb http://us.archive.ubuntu.com/ubuntu precise main universe
to /etc/apt/sources.list
, and run sudo apt-get update
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
found here with a tiny change for the udacity course to do with building with libstdc++