Address 2 OpenCV errors (raise.c and GTK) by reinstalling and rebuilding

error 1:

Unable to open 'raise.c': Unable to read file '/build/glibc-S9d2JN/glibc-2.27/sysdeps/unix/sysv/linux/raise.c' (Error: Unable to resolve non-existing file '/build/glibc-S9d2JN/glibc-2.27/sysdeps/unix/sysv/linux/raise.c').

 

error 2:

window.cpp:1239: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage

 

OpenCV rebuild cmake command: (tested successful)

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_TBB=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_GTK=ON \
-D BUILD_TIFF=ON \
-D WITH_CUDA=OFF \
-D ENABLE_AVX=OFF \
-D WITH_OPENGL=ON \
-D WITH_OPENCL=OFF \
-D WITH_IPP=OFF \
-D BUILD_TBB=ON \
-D WITH_EIGEN=OFF \
-D WITH_VTK=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules

This cmake command is a combination of the solutions in the following 2 links:

https://*.com/questions/59126945/how-can-i-solve-unable-to-open-raise-c-errorvscode-linux

https://*.com/questions/28776053/opencv-gtk2-x-error

To install OpenCV with custom build options on Linux (Ubuntu 18), please follow this link:

https://linuxize.com/post/how-to-install-opencv-on-ubuntu-18-04/

 

PS: remember to use  

make -j16

to make cmake process times faster. (The number is subject to your CPU core number. Mine is 16 core CPU).

上一篇:SQL Server进阶 SQL优化


下一篇:python scrapy 报错 raise ValueError(f'Missing scheme in request url: