为Debian Lenny编译OpenCV 2.4.2

dom*_*dom 3 unix opencv cmake

要保持问答方面:

我遇到了最新的(v.2.4.2)OpenCV版本的奇怪问题,该版本无法安装,但出现以下错误:

在/OpenCV-2.4.2/modules/core/src/system.cpp:460中包含的文件中:
/OpenCV-2.4.2/release/modules/core/version_string.inc: 37: 1:警告:缺少终止"字符在/OpenCV-2.4.2/modules/core/src/system.cpp:460中包含的文件中:/OpenCV-2.4.2/release/modules/core/version_string.inc:37:错误:缺少终止"字符

出了什么问题?看看我的回答.

dom*_*dom 6

如此错误报告中提到的,问题是cmake的旧版本(2.8.2).因此,解决方案是获取cmake源的新副本,编译它并使用它来安装OpenCV.

注意18/09/2012:这也适用于带有cmake 2.8.9的 Ubuntu 12.04!

# get the cmake src
wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz

# extract archive
tar xfvz cmake-2.8.8.tar.gz

# build the new version
cd cmake-2.8.8
cmake . 
make 
sudo make install

# get the OpenCV src
wget -O OpenCV-2.4.2.tar.bz2 http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2/download

# extract it …
tar -xvf OpenCV-2.4.2.tar.bz2

# build it
mkdir build
cd build
/usr/local/bin/cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install

# setup OpenCV
sudo echo “/usr/local/lib” >> /etc/ld.so.conf
sudo ldconfig
Run Code Online (Sandbox Code Playgroud)

而已.