1.
OpenCV 3.1 源码编译中的编译器错误:
问题:CentOS 7下,假如用户使用Anaconda发行包安装python后,OpenCV 3.1自带的Cmake会在生成makefile的过程中将python包中附带的clang编译器作为默认编译器。然而Clang编译器和OpenCV源码不兼容,不在build过程中报错。
# --------------------------------------------------
CMAKE_C_COMPILER
the compiler used for C files. Normally it is detected and set during the CMake run, but you can override it at configuration time.
# --------------------------------------------------
解决方法:
通过命令手动指定Cmake的默认c/c++编译工具:
# by setting CC anc CXX
CC=gcc-4.2 CXX=g++-4.2 cmake ..
# by passing the definitions of CMAKE_{C,CXX}_COMPILER to cmake directly
cmake -DCMAKE_C_COMPILER:FILEPATH=`which gcc-4.2` -DCMAKE_CXX_COMPILER:FILEPATH=`which g++-4.2` ...