miao@openlib:~/opencv_python/opencv-4.5.0/build$ cmake -DCMAKE_EXE_LINKER_FLAGS=-lcblas -DCMAKE_BUILD_TYPE=Release -DOPENCV_GENERATE_PKGCONFIG=ON
-DCMAKE_INSTALL_PREFIX=/usr/local cmake -DCMAKE_CXX_COMPILER=$(which g++) -DCMAKE_C_COMPILER=$(which gcc) OPENCV_EXTRA_MODULES_PATH=../opencv_co
ntrib-4.5.0/modules ..
-- The CXX compiler identification is GNU 7.5.0
-- The C compiler identification is GNU 7.5.0
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"/usr/bin/g++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/miao/opencv_python/opencv-4.5.0/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_22291/fast"
/usr/bin/make -f CMakeFiles/cmTC_22291.dir/build.make CMakeFiles/cmTC_22291.dir/build
make[1]: 進入目錄“/home/miao/opencv_python/opencv-4.5.0/build/CMakeFiles/CMakeTmp”
Building CXX object CMakeFiles/cmTC_22291.dir/testCXXCompiler.cxx.o
/usr/bin/g++ -fPIE -o CMakeFiles/cmTC_22291.dir/testCXXCompiler.cxx.o -c /home/miao/opencv_python/opencv-4.5.0/build/CMakeFiles/CMakeTmp
/testCXXCompiler.cxx
Linking CXX executable cmTC_22291
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_22291.dir/link.txt --verbose=1
/usr/bin/g++ -lcblas CMakeFiles/cmTC_22291.dir/testCXXCompiler.cxx.o -o cmTC_22291
/usr/bin/ld: 找不到 -lcblas
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_22291.dir/build.make:97: recipe for target 'cmTC_22291' failed
make[1]: *** [cmTC_22291] Error 1
make[1]: 離開目錄“/home/miao/opencv_python/opencv-4.5.0/build/CMakeFiles/CMakeTmp”
Makefile:126: recipe for target 'cmTC_22291/fast' failed
make: *** [cmTC_22291/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:109 (enable_language)
-- Configuring incomplete, errors occurred!
See also "/home/miao/opencv_python/opencv-4.5.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/miao/opencv_python/opencv-4.5.0/build/CMakeFiles/CMakeError.log".
沒有lcblas這個庫
可以定位一下
miao@openlib:~/opencv_python/opencv-4.5.0/build$ locate cblas.so
/usr/lib/x86_64-linux-gnu/libcblas.so.3
/usr/lib/x86_64-linux-gnu/libcblas.so.3.10.3
代該目錄連接一下
miao@openlib:/usr/lib/x86_64-linux-gnu$ sudo ln -s libcblas.so.3 libcblas.so
然后cmake 編譯
如果定位不到
則可以下載
sudo apt install install libcblas-dev
也可能出現以下問題
miao@openlib:/usr/lib/x86_64-linux-gnu$ sudo apt-get install libcblas-dev
正在讀取軟件包列表... 完成
正在分析軟件包的依賴關系樹
正在讀取狀態信息... 完成
沒有可用的軟件包 libcblas-dev,但是它被其它的軟件包引用了。
這可能意味着這個缺失的軟件包可能已被廢棄,
或者只能在其他發布源中找到
然而下列軟件包會取代它:
libatlas-base-dev:i386 libatlas-base-dev
E: 軟件包 libcblas-dev 沒有可安裝候選
解決方法:
sudo apt install libatlas-base-dev
sudo apt install libjasper-dev
sudo apt install libqt4-test
參考以下
https://blog.csdn.net/kevindree/article/details/88772691