OpenCV-2.1.0.tar.bz2编译安装???
系统环境:centos5.9 64bit
一:安装cmake-2.8.11.1
步骤:
1: ./configure
2: make
3: sudo make install
二:安装jasper-1.900.1
1: ./configure
2: make
3: sudo make install
三:安装opencv-2.1.0
1: cmake .
[tzgly@localhost OpenCV-2.1.0]$ cmake .
-- Extracting svn version, please wait...
-- SVNVERSION: svn:已导出
-- Detected version of GNU GCC: 41 (401)
-- checking for module 'gstreamer-base-0.10'
-- package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-app-0.10'
-- package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-video-0.10'
-- package 'gstreamer-video-0.10' not found
-- checking for module 'libavcodec'
-- package 'libavcodec' not found
-- checking for module 'libavformat'
-- package 'libavformat' not found
-- checking for module 'libavutil'
-- package 'libavutil' not found
-- checking for module 'libswscale'
-- package 'libswscale' not found
-- checking for module 'libdc1394-2'
-- package 'libdc1394-2' not found
-- checking for module 'libdc1394'
-- package 'libdc1394' not found
-- checking for module 'libv4l1'
-- package 'libv4l1' not found
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find Jasper (missing: JPEG_LIBRARIES) (found version "1.900.1")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named numpy.distutils
-- IPP detected:
-- Parsing 'cvconfig.h.cmake'
running mkdir -p "/home/tzgly/software/ex_installs/OpenCV-2.1.0/unix-install/" 2>&1
--
-- General configuration for opencv 2.1.0 =====================================
--
-- Built as dynamic libs?: ON
-- Compiler:
-- C++ flags (Release): -Wall -Wno-long-long -pthread -ffunction-sections -O3 -DNDEBUG -fomit-frame-pointer -O3 -ffast-math -msse -msse2 -DNDEBUG
-- C++ flags (Debug): -Wall -Wno-long-long -pthread -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
--
-- GUI:
-- GTK+ 2.x: 1
-- GThread: 1
--
-- Image I/O:
-- JPEG: build
-- PNG: TRUE
-- TIFF: build
-- JPEG 2000: build
--
-- Video I/O:
-- DC1394 1.x: 0
-- DC1394 2.x: 0
-- FFMPEG: 0
-- codec: 0
-- format: 0
-- util: 0
-- swscale: 0
-- gentoo-style:
-- GStreamer: 0
-- UniCap: FALSE
-- PvAPI:
-- V4L/V4L2: /
-- Xine: FALSE
--
-- Interfaces:
-- Old Python: 0
-- Python: ON
-- Python interpreter: /usr/bin/python
-- Python numpy: 0
-- Use IPP: NO
-- Use TBB: NO
-- Build Documentation 0
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/tzgly/software/ex_installs/OpenCV-2.1.0
-- -----------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tzgly/software/ex_installs/OpenCV-2.1.0
[tzgly@localhost OpenCV-2.1.0]$
2: make (失败,如下:)
[ 72%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jccoefct.o
Linking C static library ../lib/liblibjpeg.a
[ 72%] Built target libjpeg
make[2]: 放弃循环依赖 src/highgui/_highgui.h <- src/highgui/_highgui.h 。
Scanning dependencies of target highgui
make[2]: 放弃循环依赖 src/highgui/_highgui.h <- src/highgui/_highgui.h 。
[ 72%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap.o
[ 72%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_images.o
[ 72%] Building CXX object src/highgui/CMakeFiles/highgui.dir/image.o
[ 72%] Building CXX object src/highgui/CMakeFiles/highgui.dir/loadsave.o
[ 72%] Building CXX object src/highgui/CMakeFiles/highgui.dir/precomp.o
[ 72%] Building CXX object src/highgui/CMakeFiles/highgui.dir/utils.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/window.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/window_gtk.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/bitstrm.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_jpeg.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_pxm.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_jpeg2000.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_base.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_imageio.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_png.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_bmp.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_exr.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_sunras.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_tiff.o
Linking CXX shared library ../../lib/libhighgui.so
/usr/bin/ld: /usr/local/lib/libjasper.a(jas_cm.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libjasper.a: could not read symbols: Bad value
collect2: ld 返回 1
make[2]: *** [lib/libhighgui.so.2.1.0] 错误 1
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] 错误 2
make: *** [all] 错误 2
[tzgly@localhost OpenCV-2.1.0]$
为什么????
怎么解决???
谢谢!!!
[解决办法]
我前段时间在centOS上安装openCV,也出过很多问题。不知道你有没有解决,我把我的当时看的资料发给你:http://blog.csdn.net/andy_baby/article/details/9093237