Inter IPP & Opencv + codeblocks 在centos 环境下的配置

时间:2020-12-31 15:31:32

一、先安装codeblocks

wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm

wget http://rpm.jenslody.de/centos-jenslody.de-0.1-2.noarch.rpm

sudo rpm -Uvh epel-release-7*.rpm

sudo yum install wxGTK gcc gcc-c++ codeblocks

完成安装

二、下载IPP

https://software.intel.com/en-us/ipp

https://registrationcenter.intel.com/zh/products/download

解压:    tar zxvf l_ipp_2018.4.274.tgz

安装:   sudo ./install_GUI.sh

(参考:https://yang7229693.iteye.com/blog/985645)

我配置的时候找不到头文件的目录,折腾了半天最后从windows的版本里面拷了一份进来

注:windows版本下的安装目录里面除了windows的链接库,还有一个linux的库,直接copy进linux相应的位置可以用!

三、安装opencv (参考:https://blog.csdn.net/qinglongzhan/article/details/81942935)

先装依赖:

sudo yum install cmake

sudo yum install gcc gcc-c++ kernel-devel

sudo yum install gcc-gfortran

sudo yum install git

sudo yum install gtk2 gtk2-devel gtk2-devel-docs

sudo yum install gnome-devel gnome-devel-docs

sudo yum install python-devel numpy

sudo yum install libdc1394-devel

sudo yum install libv4l-devel

sudo yum install gstreamer-plugins-base-devel

https://opencv.org/releases/

unzip opencv-3.4.7

cd opencv -3.4.7
mkdir build
cd build

cmake -D WITH_TBB=ON -D WITH_EIGEN=ON ..
cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF ..
cmake -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

make
sudo make install

cd /etc/ld.so.conf.d

sudo /bin/bash -c 'echo "/usr/local/lib64" > /etc/ld.so.conf.d/opencv.conf'

sudo ldconfig

sido gedit /etc/bashrc

添加:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

export PKG_CONFIG_PATH

source /etc/bashrc

sudo updatedb

sudo cp -r /usr/local/lib64/pkgconfig /usr/lib/pkgconfig

测试,成功。

四、配置codeblocks,添加opencv库

新建空工程

右击项目名称,选build options

依次点击:Search directories->Complier->Add,选择头文件所在目录,添加头文件路径:

/usr/local/include

/usr/local/include/opencv

/usr/local/include/opencv2

点击Linker->Add,选择lib库路径,添加路径:

/usr/local/lib64

点击 Linker settings,添加相应库文件,所有lib库文件全部添加进去

五、配置codeblocks,添加IPP库

右击项目名称,选build options

依次点击:Search directories->Complier->Add,选择头文件所在目录,添加头文件路径:

/opt/intel/compilers_and_libraries_2018.5.274/linux/ipp/include

点击Linker->Add,选择lib库路径,添加路径:

/opt/intel/compilers_and_libraries_2018.5.274/linux/ipp/lib/intel64_lin

点击 Linker settings,添加相应库文件,所有lib库文件全部添加进去(.so)

注意!不要把.a文件添加进去