cmake cv::findHomography中的非法指令(核心转储)

zyfwsgd6  于 2024-01-09  发布在  其他
关注(0)|答案(1)|浏览(228)

我得到这个错误:

  1. Illegal instruction (core dumped)

字符串
打电话时:

  1. cv::findHomography(query_points, reference_points, cv::RANSAC, homography_ransac_threshold_, h_mask);


这只发生在一台装有AMD EPYC 7R32 CPU的AWS EC2 g5机器上。代码在其他装有Intel CPU的机器上运行良好。
我已经从机器上的源代码构建了OpenCV(旧版4.8.1和4.51),使用:

  1. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_CUDA=ON -D BUILD_opencv_cudacodec=OFF -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -DCUDA_ARCH_BIN=8.6 -DCUDA_ARCH_PTX=8.6 -D WITH_V4L=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -D WITH_GSTREAMER=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_PC_FILE_NAME=opencv.pc -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=~/other_sources/opencv_contrib-4.5.1/modules -D INSTALL_PYTHON_EXAMPLES=OFF -D INSTALL_C_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF -DBUILD_opencv_sfm=OFF -DBUILD_JAVA=OFF -DCPU_DISPATCH=SSE4_2,AVX -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 -DWITH_IPP=OFF -D BUILD_opencv_alphamat=OFF -D BUILD_opencv_apps=OFF -D BUILD_opencv_aruco=OFF -D BUILD_opencv_bgsegm=OFF -D BUILD_opencv_bioinspired=OFF -D BUILD_opencv_cudacodec=OFF -D BUILD_opencv_datasets=OFF -D BUILD_opencv_dpm=OFF -D BUILD_opencv_face=OFF -D BUILD_opencv_fuzzy=OFF -D BUILD_opencv_hdf=OFF -D BUILD_opencv_hfs=OFF -D BUILD_opencv_img_hash=OFF -D BUILD_opencv_java_bindings_generator=OFF -D BUILD_opencv_js=OFF -D BUILD_opencv_js_bindings_generator=OFF -D BUILD_opencv_line_descriptor=OFF -D BUILD_opencv_mcc=OFF -D BUILD_opencv_plot=OFF -D BUILD_opencv_python_tests=OFF -D BUILD_opencv_quality=OFF -D BUILD_opencv_rapid=OFF -D BUILD_opencv_reg=OFF -D BUILD_opencv_rgbd=OFF -D BUILD_opencv_saliency=OFF -D BUILD_opencv_shape=OFF -D BUILD_opencv_structured_light=OFF ..


CMake out是:

  1. -- Detected processor: x86_64
  2. -- Looking for ccache - not found
  3. -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
  4. Cleaning INTERNAL cached variable: WEBP_LIBRARY
  5. Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
  6. -- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
  7. -- OpenJPEG: VERSION = 2.3.1, BUILD = opencv-4.5.1-openjp2-2.3.1
  8. -- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.3.1")
  9. -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
  10. -- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
  11. -- Checking for module 'gtk+-3.0'
  12. -- No package 'gtk+-3.0' found
  13. -- Checking for module 'gtk+-2.0'
  14. -- No package 'gtk+-2.0' found
  15. -- Checking for module 'gtkglext-1.0'
  16. -- No package 'gtkglext-1.0' found
  17. -- Found TBB (env): /usr/lib/x86_64-linux-gnu/libtbb.so
  18. -- CUDA detected: 11.4
  19. -- CUDA: Using CUDA_ARCH_BIN=8.6
  20. -- CUDA NVCC target flags: -gencode;arch=compute_86,code=sm_86;-D_FORCE_INLINES;-gencode;arch=compute_86,code=compute_86
  21. -- LAPACK(OpenBLAS): LAPACK_LIBRARIES: /usr/local/lib/libopenblas.so
  22. -- LAPACK(OpenBLAS): Support is enabled.
  23. -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
  24. -- OpenCV Python: during development append to PYTHONPATH: /home/humamhelfawi/other_sources/opencv-4.5.1/_build/python_loader
  25. -- Checking for module 'gstreamer-base-1.0'
  26. -- No package 'gstreamer-base-1.0' found
  27. -- Checking for module 'gstreamer-app-1.0'
  28. -- No package 'gstreamer-app-1.0' found
  29. -- Checking for module 'gstreamer-riff-1.0'
  30. -- No package 'gstreamer-riff-1.0' found
  31. -- Checking for module 'gstreamer-pbutils-1.0'
  32. -- No package 'gstreamer-pbutils-1.0' found
  33. -- Caffe: NO
  34. -- Protobuf: NO
  35. -- Glog: YES
  36. -- freetype2: YES (ver 21.0.15)
  37. -- harfbuzz: YES (ver 1.7.2)
  38. -- Julia not found. Not compiling Julia Bindings.
  39. -- Module opencv_ovis disabled because OGRE3D was not found
  40. -- Found AMD headers in: /usr/include/suitesparse
  41. -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
  42. -- Found CAMD headers in: /usr/include/suitesparse
  43. -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
  44. -- Found CCOLAMD headers in: /usr/include/suitesparse
  45. -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
  46. -- Found CHOLMOD headers in: /usr/include/suitesparse
  47. -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
  48. -- Found COLAMD headers in: /usr/include/suitesparse
  49. -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
  50. -- Found SPQR headers in: /usr/include/suitesparse
  51. -- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
  52. -- Found Config headers in: /usr/include/suitesparse
  53. -- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
  54. -- Did not find Intel TBB library, assuming SuiteSparseQR was not compiled with TBB.
  55. -- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
  56. -- Could NOT find METIS (missing: METIS_INCLUDE_DIR METIS_LIBRARY)
  57. -- Found AMD headers in: /usr/include/suitesparse
  58. -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
  59. -- Found CAMD headers in: /usr/include/suitesparse
  60. -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
  61. -- Found CCOLAMD headers in: /usr/include/suitesparse
  62. -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
  63. -- Found CHOLMOD headers in: /usr/include/suitesparse
  64. -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
  65. -- Found COLAMD headers in: /usr/include/suitesparse
  66. -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
  67. -- Found SPQR headers in: /usr/include/suitesparse
  68. -- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
  69. -- Found Config headers in: /usr/include/suitesparse
  70. -- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
  71. -- Did not find Intel TBB library, assuming SuiteSparseQR was not compiled with TBB.
  72. -- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
  73. -- Could NOT find METIS (missing: METIS_INCLUDE_DIR METIS_LIBRARY)
  74. -- Checking for module 'tesseract'
  75. -- No package 'tesseract' found
  76. -- Tesseract: NO
  77. -- Module opencv_tracking disabled because opencv_plot dependency can't be resolved!
  78. -- Module opencv_stereo disabled because opencv_tracking dependency can't be resolved!
  79. -- Allocator metrics storage type: 'long long'
  80. -- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.fp16.cpp
  81. -- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx2.cpp
  82. -- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx512_skx.cpp
  83. -- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx2.cpp
  84. -- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx512_skx.cpp
  85. -- Excluding from source files list: <BUILD>/modules/core/test/test_intrin512.avx512_skx.cpp
  86. -- Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
  87. -- Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
  88. -- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/humamhelfawi/other_sources/opencv-4.5.1/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
  89. -- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
  90. -- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
  91. -- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
  92. --
  93. -- General configuration for OpenCV 4.5.1 =====================================
  94. -- Version control: unknown
  95. --
  96. -- Extra modules:
  97. -- Location (extra): /home/humamhelfawi/other_sources/opencv_contrib-4.5.1/modules
  98. -- Version control (extra): unknown
  99. --
  100. -- Platform:
  101. -- Timestamp: 2023-10-27T19:43:28Z
  102. -- Host: Linux 5.4.0-1099-aws x86_64
  103. -- CMake: 3.26.1
  104. -- CMake generator: Unix Makefiles
  105. -- CMake build tool: /usr/bin/make
  106. -- Configuration: RELEASE
  107. --
  108. -- CPU/HW features:
  109. -- Baseline: SSE SSE2 SSE3
  110. -- requested: SSE3
  111. -- Dispatched code generation: SSE4_2 AVX
  112. -- SSE4_2 (6 files): + SSSE3 SSE4_1 POPCNT SSE4_2
  113. -- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
  114. --
  115. -- C/C++:
  116. -- Built as dynamic libs?: YES
  117. -- C++ standard: 11
  118. -- C++ Compiler: /usr/bin/c++ (ver 9.4.0)
  119. -- C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
  120. -- C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
  121. -- C Compiler: /usr/bin/cc
  122. -- C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
  123. -- C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
  124. -- Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed
  125. -- Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed
  126. -- ccache: NO
  127. -- Precompiled headers: NO
  128. -- Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-11.4/lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/local/cuda-11.4/lib
  129. -- 3rdparty dependencies:
  130. --
  131. -- OpenCV modules:
  132. -- To be built: calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev dnn dnn_objdetect dnn_superres features2d flann freetype gapi highgui imgcodecs imgproc intensity_transform ml objdetect optflow phase_unwrapping photo stitching superres surface_matching text ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
  133. -- Disabled: alphamat aruco bgsegm bioinspired cudacodec datasets dpm face fuzzy hdf hfs img_hash java_bindings_generator js_bindings_generator line_descriptor mcc plot python_tests quality rapid reg rgbd saliency sfm shape structured_light world
  134. -- Disabled by dependency: stereo tracking
  135. -- Unavailable: cnn_3dobj cvv java julia matlab ovis python2 python3 viz
  136. -- Applications: tests perf_tests
  137. -- Documentation: NO
  138. -- Non-free algorithms: YES
  139. --
  140. -- GUI:
  141. -- GTK+: NO
  142. -- OpenGL support: NO
  143. -- VTK support: NO
  144. --
  145. -- Media I/O:
  146. -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
  147. -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
  148. -- WEBP: build (ver encoder: 0x020f)
  149. -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
  150. -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
  151. -- JPEG 2000: build (ver 2.3.1)
  152. -- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2_2)
  153. -- HDR: YES
  154. -- SUNRASTER: YES
  155. -- PXM: YES
  156. -- PFM: YES
  157. --
  158. -- Video I/O:
  159. -- DC1394: YES (2.2.5)
  160. -- FFMPEG: YES
  161. -- avcodec: YES (57.107.100)
  162. -- avformat: YES (57.83.100)
  163. -- avutil: YES (55.78.100)
  164. -- swscale: YES (4.8.100)
  165. -- avresample: YES (3.7.0)
  166. -- GStreamer: NO
  167. -- v4l/v4l2: YES (linux/videodev2.h)
  168. --
  169. -- Parallel framework: TBB (ver 2017.0 interface 9107)
  170. --
  171. -- Trace: YES (with Intel ITT)
  172. --
  173. -- Other third-party libraries:
  174. -- Lapack: YES (/usr/local/lib/libopenblas.so)
  175. -- Eigen: YES (ver 3.3.4)
  176. -- Custom HAL: NO
  177. -- Protobuf: build (3.5.1)
  178. --
  179. -- NVIDIA CUDA: YES (ver 11.4, CUFFT CUBLAS FAST_MATH)
  180. -- NVIDIA GPU arch: 86
  181. -- NVIDIA PTX archs: 86
  182. --
  183. -- cuDNN: YES (ver 8.4.0)
  184. --
  185. -- OpenCL: YES (no extra features)
  186. -- Include path: /home/humamhelfawi/other_sources/opencv-4.5.1/3rdparty/include/opencl/1.2
  187. -- Link libraries: Dynamic load
  188. --
  189. -- Python (for build): /usr/bin/python2.7
  190. --
  191. -- Install to: /usr/local
  192. -- -----------------------------------------------------------------
  193. --
  194. -- Configuring done (3.4s)
  195. -- Generating done (0.8s)


似乎调用了CPU不支持的优化指令之一。
你能帮我修改CMake调用来禁用那个优化吗?

ztyzrc3y

ztyzrc3y1#

感谢评论,原来是OpenBLAS导致了这个问题。我已经从OpenCV构建中排除了它,错误就消失了。

相关问题