在编译opencv3.0.0的过程中,前面与之前的并无多大区别,大家可以在网上找到很多资料,关键是到samples/c中运行./build_all.sh时会出现问题,我出现的问题是
g++: error: tbb: No such file or directory
g++: error: rt: No such file or directory
g++: error: pthread: No such file or directory
g++: error: m: No such file or directory
g++: error: dl: No such file or directory
其它配置都已经配好,但还是会找不到这些库,locate他们的位置看系统中装了这些库没有,结果都是有的,那么就是文件路径不对了。打开opencv.pc,(/usr/local/lib/pkgconfig,我build也是默认的路径uer/local/),代开会发现lib后面刚好会有tbb、rt、pthread、m、dl没有指定库路径,这就是问题所在,然后将locate tbb出现的库路径为/usr/lib/libtbb.so,以及其它locate librt.so等找到的路径等,对tbb、rt、pthread、m、dl进行修改为/usr/lib/libtbb.so,/usr/lib/x86_64-linux-gnu/libpthread.so,/usr/lib/x86_64-linux-gnu/libm.so,/usr/lib/x86_64-linux-gnu/libdl.so,,然后再编译,就可以OK了。
其实就是路径的问题,这些库其实是在/usr/lib中的,而我们定义默认路径是/usr/local/lib,这样是搜索不到这些库的。当然还有其他方法解决,我这只是对我的解决方法分享一下大家,让大家碰到这些问题的时候有一定的方向。