opencv installation on redhat 5.7

asked 2014-08-11 04:10:15 -0500

I am using below script to do the opencv installation on 64-bit redhat 5.7.

my problem is, when I run cmake, it is taking too long time like more than one day and still didn`t finish and get killed by losing the connection.

anyway, my question is, is it normal to run this long? I successfully installed on ubuntu 14.04 and it took at most one hour.

even though the platform is different, but is it possible to differ this much (i mean in terms of time spent on cmake operation).

Here is the code:

# Dan Walkes
# 2014-01-29
# Call this script after configuring variables:
# version - the version of OpenCV to be installed
# downloadfile - the name of the OpenCV download file
# dldir - the download directory (optional, if not specified creates an OpenCV directory in the working dir)
version="2.4.9"
downloadfile="opencv-2.4.9.zip"
echo $version
if [[ -z "$version" ]]; then
    echo "Please define version before calling `basename $0` or use a wrapper like opencv_latest.sh"
    exit 1
fi
if [[ -z "$downloadfile" ]]; then
    echo "Please define downloadfile before calling `basename $0` or use a wrapper like opencv_latest.sh"
    exit 1
fi
if [[ -z "$dldir" ]]; then
    dldir=OpenCV
fi
echo "Installing OpenCV" $version
mkdir -p $dldir
cd $dldir
echo "Installing Dependencies"
sudo yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum -y groupinstall "Development Tools"
sudo yum -y install wget unzip opencv opencv-devel gtk2-devel cmake
if [ ! -f $downloadfile ]; then
    echo "Downloading OpenCV" $version
    wget -O $downloadfile http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/$downloadfile/download
fi
if [ ! -d opencv-$version ]; then
    echo "Installing OpenCV" $version
    echo $downloadfile | grep ".zip"
    if [ $? -eq 0 ]; then
        unzip $downloadfile
    else
        tar -xvf $downloadfile
    fi
fi
cd opencv-$version
cmake --version | grep " 2.6"
if [ $? -eq 0 ]; then
    # Delete lines beginning with string(MD5 based on incompatibility with cmake 2.6.  See 
    # http://answers.opencv.org/question/24095/building-opencv-247-on-centos-6/
    sed  -i '/string(MD5/d' cmake/cl2cpp.cmake
fi
rm -fr build
mkdir -p build
cd build
**sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER=/usr/bin/g++44 -DCMAKE_C_COMPILER=/usr/bin/gcc44 -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D WITH_TBB=ON -D WITH_EIGEN=ON ..**
sudo make -j 4
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV" $version "ready to be used"

if anybody could help or provide me with a better script, I would highly appreciated. p.s. as you can see, the script is from Dan Walkes, I found it somewhere on the internet.

thanks

edit retag flag offensive close merge delete

Comments

1

It is not normal for the cmake command to take that long. On my machine it takes less than a minute. Can you run the cmake command without using the script? So manually download, unpack, create a build directory and run cmake with the appropriate options. What version of cmake do you use?

boaz001 gravatar imageboaz001 ( 2014-08-11 10:56:29 -0500 )edit

my cmake version is 2.8.10.2. and I did as you suggested, run the command one by one, and miraculously, it works and I am done with installation within minutes.

thank you very much for the suggesion and I am wondering what is the difference between with and without the script.

phoenixbai gravatar imagephoenixbai ( 2014-08-11 21:54:11 -0500 )edit