Reading a video on GPU using C++ and CUDA - c++

Hi everyone and thanks for your answers
First of all is, as #zkoza and #talonmies pointed it out, Jetson AGX Xavier are compatible with ARCH 7.2 and not ARCH 5.3 which was used in Jetson Nano's case.
To #Yunus Temurlenk => the fname in my code is only myvideo.MOV since i execute my code in the same repertory of the movie, i also tried with a .mp4 file got from sample in internet resulting the same error.
Yes as you pointed out my NVCUVID is not ON after the cmake command as you can see in my original post the line corresponding to CUDA is
NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
and not
NVIDIA CUDA: YES (ver 10.2, CUFFT NVCUVID CUBLAS FAST_MATH)
I don't know which dependencies are missing but i also saw here that NVCUVID was deprecated : https://docs.nvidia.com/cuda/video-decoder/index.html
The example from step 6 of cuda works fine :)
I'm currently making opencv 4.3.0 with cuda 10.2 I will update my answer if this solve my problem.
EDIT : Unfortunately the problem is exactly the same using openCV 4.3.0 and Cuda 10.2 on Ubuntu 18.04, but i wanted to add that I compiling with this command :
g++ video_reader.cpp -o vr.exe `pkg-config --cflags --libs opencv4`
since g++ by itself give me this error :
video_reader.cpp:3:10: fatal error: opencv2/opencv_modules.hpp: No such file or directory
#include "opencv2/opencv_modules.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
So, maybe my compilation command is the problem ?
END EDIT
To #user2986898 and #einpoklum => i ran cv::getBuildInformation() and 2 other functions : the number of device(s) and the number of device(s) compatible(s). The number of device and compatible device was 1 as expected and the build information are :
General configuration for OpenCV 4.5.1 =====================================
Version control: unknown
Extra modules:
Location (extra): /home/dronemaitre/Documents/opencv_cpp/opencv_contrib/modules
Version control (extra): unknown
Platform:
Timestamp: 2021-01-18T10:12:44Z
Host: Linux 4.9.140-tegra aarch64
CMake: 3.10.2
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline: NEON FP16
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 7.5.0)
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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed
Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed
ccache: NO
Precompiled headers: NO
Extra dependencies: m pthread /usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-10.2/lib64 -L/usr/lib/aarch64-linux-gnu
3rdparty dependencies:
OpenCV modules:
To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cnn_3dobj java julia matlab ovis viz
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO
GUI:
QT: YES (ver 5.9.5)
QT OpenGL support: YES (Qt5::OpenGL 5.9.5)
GTK+: NO
OpenGL support: YES (/usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so)
VTK support: NO
Media I/O:
ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
WEBP: build (ver encoder: 0x020f)
PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
JPEG 2000: build (ver 2.3.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (57.107.100)
avformat: YES (57.83.100)
avutil: YES (55.78.100)
swscale: YES (4.8.100)
avresample: YES (3.7.0)
GStreamer: YES (1.14.5)
v4l/v4l2: YES (linux/videodev2.h)
Parallel framework: TBB (ver 2017.0 interface 9107)
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.3.4)
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)
NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
NVIDIA GPU arch: 72
NVIDIA PTX archs:
cuDNN: YES (ver 8.0.0)
OpenCL: YES (no extra features)
Include path: /home/dronemaitre/Documents/opencv_cpp/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.17)
Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python2.7/dist-packages/cv2/python-2.7
Python 3:
Interpreter: /usr/bin/python3 (ver 3.6.9)
Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python3.6/dist-packages/cv2/python-3.6
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: /usr/local
-----------------------------------------------------------------
It seems Cuda is found by OpenCV but again here we can see that NVCUVID is not added even so i put -D NVCUVID=ON as you said it might be ignored because not compatible with my config.
EDIT : ccmake command ran in my build folder gives me this output :
ANT_EXECUTABLE ANT_EXECUTABLE-NOTFOUND
Atlas_BLAS_LIBRARY /usr/lib/aarch64-linux-gnu/libatlas.so
Atlas_CBLAS_INCLUDE_DIR /usr/include/aarch64-linux-gnu
Atlas_CBLAS_LIBRARY /usr/lib/aarch64-linux-gnu/libcblas.so
Atlas_CLAPACK_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR-NOTFOUND
Atlas_LAPACK_LIBRARY /usr/lib/aarch64-linux-gnu/liblapack.so
BUILD_CUDA_STUBS OFF
BUILD_DOCS OFF
BUILD_EXAMPLES OFF
BUILD_ITT ON
BUILD_JASPER OFF
BUILD_JAVA ON
BUILD_JPEG OFF
BUILD_LIST
BUILD_OPENEXR OFF
BUILD_PACKAGE ON
BUILD_PERF_TESTS ON
BUILD_PNG OFF
BUILD_PROTOBUF ON
BUILD_SHARED_LIBS ON
BUILD_TBB OFF
BUILD_TESTS ON
BUILD_TIFF OFF
BUILD_USE_SYMLINKS OFF
BUILD_WEBP OFF
BUILD_WITH_DEBUG_INFO OFF
BUILD_WITH_DYNAMIC_IPP OFF
BUILD_ZLIB OFF
BUILD_opencv_alphamat ON
BUILD_opencv_apps ON
BUILD_opencv_aruco ON
BUILD_opencv_bgsegm ON
BUILD_opencv_bioinspired ON
BUILD_opencv_calib3d ON
BUILD_opencv_ccalib ON
BUILD_opencv_core ON
BUILD_opencv_cudaarithm ON
BUILD_opencv_cudabgsegm ON
BUILD_opencv_cudacodec ON
BUILD_opencv_cudafeatures2d ON
BUILD_opencv_cudafilters ON
BUILD_opencv_cudaimgproc ON
BUILD_opencv_cudalegacy ON
BUILD_opencv_cudaobjdetect ON
BUILD_opencv_cudaoptflow ON
BUILD_opencv_cudastereo ON
BUILD_opencv_cudawarping ON
BUILD_opencv_cudev ON
BUILD_opencv_cvv ON
BUILD_opencv_datasets ON
BUILD_opencv_dnn ON
BUILD_opencv_dnn_objdetect ON
BUILD_opencv_dnn_superres ON
BUILD_opencv_dpm ON
BUILD_opencv_face ON
BUILD_opencv_features2d ON
BUILD_opencv_flann ON
BUILD_opencv_freetype ON
BUILD_opencv_fuzzy ON
BUILD_opencv_gapi ON
BUILD_opencv_hdf ON
BUILD_opencv_hfs ON
BUILD_opencv_highgui ON
BUILD_opencv_img_hash ON
BUILD_opencv_imgcodecs ON
BUILD_opencv_imgproc ON
BUILD_opencv_intensity_transfo ON
BUILD_opencv_java_bindings_gen ON
BUILD_opencv_js OFF
BUILD_opencv_line_descriptor ON
BUILD_opencv_ml ON
BUILD_opencv_objdetect ON
BUILD_opencv_optflow ON
BUILD_opencv_phase_unwrapping ON
BUILD_opencv_photo ON
BUILD_opencv_plot ON
BUILD_opencv_python2 ON
BUILD_opencv_python3 ON
BUILD_opencv_python_bindings_g ON
BUILD_opencv_python_tests ON
BUILD_opencv_quality ON
BUILD_opencv_rapid ON
BUILD_opencv_reg ON
BUILD_opencv_rgbd ON
BUILD_opencv_saliency ON
BUILD_opencv_sfm ON
BUILD_opencv_shape ON
BUILD_opencv_stereo ON
BUILD_opencv_stitching ON
BUILD_opencv_structured_light ON
BUILD_opencv_superres ON
BUILD_opencv_surface_matching ON
BUILD_opencv_text ON
BUILD_opencv_tracking ON
BUILD_opencv_ts ON
BUILD_opencv_video ON
BUILD_opencv_videoio ON
BUILD_opencv_videostab ON
BUILD_opencv_world OFF
BUILD_opencv_xfeatures2d ON
BUILD_opencv_ximgproc ON
BUILD_opencv_xobjdetect ON
BUILD_opencv_xphoto ON
CAROTENE_NS carotene_o4t
CCACHE_PROGRAM CCACHE_PROGRAM-NOTFOUND
CLAMDBLAS_INCLUDE_DIR CLAMDBLAS_INCLUDE_DIR-NOTFOUND
CLAMDBLAS_ROOT_DIR CLAMDBLAS_ROOT_DIR-NOTFOUND
CLAMDFFT_INCLUDE_DIR CLAMDFFT_INCLUDE_DIR-NOTFOUND
CLAMDFFT_ROOT_DIR CLAMDFFT_ROOT_DIR-NOTFOUND
CMAKE_BUILD_TYPE RELEASE
CMAKE_CONFIGURATION_TYPES Debug;Release
CMAKE_INSTALL_PREFIX /usr/local
CPU_BASELINE NEON;FP16
CPU_BASELINE_DISABLE ;VFPV3
CPU_BASELINE_REQUIRE ;NEON
CPU_DISPATCH
CUDA_ARCH_BIN 7.2
CUDA_ARCH_PTX
CUDA_FAST_MATH ON
CUDA_GENERATION
CUDA_HOST_COMPILER /usr/bin/cc
CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-10.2
CUDA_USE_STATIC_CUDA_RUNTIME ON
CUDA_rt_LIBRARY /usr/lib/aarch64-linux-gnu/librt.so
CV_DISABLE_OPTIMIZATION OFF
CV_ENABLE_INTRINSICS ON
CV_TRACE ON
Caffe_INCLUDE_DIR Caffe_INCLUDE_DIR-NOTFOUND
Caffe_LIBS Caffe_LIBS-NOTFOUND
Ceres_DIR Ceres_DIR-NOTFOUND
ENABLE_BUILD_HARDENING OFF
ENABLE_CCACHE ON
ENABLE_CONFIG_VERIFICATION OFF
ENABLE_COVERAGE OFF
ENABLE_FAST_MATH ON
ENABLE_FLAKE8 OFF
ENABLE_GNU_STL_DEBUG OFF
ENABLE_IMPL_COLLECTION OFF
ENABLE_INSTRUMENTATION OFF
ENABLE_LTO OFF
ENABLE_NEON ON
ENABLE_NOISY_WARNINGS OFF
ENABLE_OMIT_FRAME_POINTER ON
ENABLE_PIC ON
ENABLE_PRECOMPILED_HEADERS OFF
ENABLE_PROFILING OFF
ENABLE_PYLINT OFF
ENABLE_SOLUTION_FOLDERS OFF
ENABLE_VFPV3 OFF
EXECUTABLE_OUTPUT_PATH /home/dronemaitre/Documents/opencv_cpp/opencv/build/bin
Eigen3_DIR /usr/lib/cmake/eigen3
GENERATE_ABI_DESCRIPTOR OFF
Glog_LIBS /usr/lib/aarch64-linux-gnu/libglog.so
HDF5_C_LIBRARY_dl /usr/lib/aarch64-linux-gnu/libdl.so
HDF5_C_LIBRARY_hdf5 /usr/lib/aarch64-linux-gnu/hdf5/serial/libhdf5.so
HDF5_C_LIBRARY_m /usr/lib/aarch64-linux-gnu/libm.so
HDF5_C_LIBRARY_pthread /usr/lib/aarch64-linux-gnu/libpthread.so
HDF5_C_LIBRARY_sz /usr/lib/aarch64-linux-gnu/libsz.so
HDF5_C_LIBRARY_z /usr/lib/aarch64-linux-gnu/libz.so
INSTALL_CREATE_DISTRIB OFF
INSTALL_C_EXAMPLES OFF
INSTALL_PYTHON_EXAMPLES OFF
INSTALL_TESTS OFF
INSTALL_TO_MANGLED_PATHS OFF
LAPACKE_INCLUDE_DIR LAPACKE_INCLUDE_DIR-NOTFOUND
LAPACK_CBLAS_H
LAPACK_IMPL Unknown
LAPACK_INCLUDE_DIR
LAPACK_LAPACKE_H
LAPACK_LIBRARIES
Lept_LIBRARY Lept_LIBRARY-NOTFOUND
MKL_INCLUDE_DIRS MKL_ROOT_DIR-NOTFOUND/include
MKL_LAPACKE_INCLUDE_DIR MKL_LAPACKE_INCLUDE_DIR-NOTFOUND
MKL_ROOT_DIR MKL_ROOT_DIR-NOTFOUND
MKL_WITH_OPENMP OFF
MKL_WITH_TBB OFF
OGRE_DIR OGRE_DIR-NOTFOUND
OPENCL_FOUND ON
OPENCV_CONFIG_FILE_INCLUDE_DIR /home/dronemaitre/Documents/opencv_cpp/opencv/build
OPENCV_DNN_CUDA OFF
OPENCV_DNN_OPENCL ON
OPENCV_DOWNLOAD_PATH /home/dronemaitre/Documents/opencv_cpp/opencv/.cache
OPENCV_DUMP_HOOKS_FLOW OFF
OPENCV_ENABLE_ALLOCATOR_STATS ON
OPENCV_ENABLE_ATOMIC_LONG_LONG OFF
OPENCV_ENABLE_MEMALIGN ON
OPENCV_ENABLE_MEMORY_SANITIZER OFF
OPENCV_ENABLE_NONFREE OFF
OPENCV_EXTRA_MODULES_PATH /home/dronemaitre/Documents/opencv_cpp/opencv_contrib/modules
OPENCV_FORCE_3RDPARTY_BUILD OFF
OPENCV_FORCE_PYTHON_LIBS OFF
OPENCV_GENERATE_PKGCONFIG ON
OPENCV_GENERATE_SETUPVARS ON
OPENCV_JAVA_SOURCE_VERSION
OPENCV_JAVA_TARGET_VERSION
OPENCV_MATHJAX_RELPATH https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0
OPENCV_PYTHON3_VERSION OFF
OPENCV_TIMESTAMP 2021-01-18T12:55:10Z
OPENCV_WARNINGS_ARE_ERRORS OFF
OPENEXR_INCLUDE_PATH OPENEXR_INCLUDE_PATH-NOTFOUND
OpenCV_HAL_DIR OpenCV_HAL_DIR-NOTFOUND
OpenJPEG_DIR OpenJPEG_DIR-NOTFOUND
PROTOBUF_UPDATE_FILES OFF
PYTHON2_EXECUTABLE /usr/bin/python2.7
PYTHON2_INCLUDE_DIR /usr/include/python2.7
PYTHON2_INCLUDE_DIR2
PYTHON2_LIBRARY /usr/lib/aarch64-linux-gnu/libpython2.7.so
PYTHON2_LIBRARY_DEBUG
PYTHON2_NUMPY_INCLUDE_DIRS /usr/lib/python2.7/dist-packages/numpy/core/include
PYTHON2_PACKAGES_PATH lib/python2.7/dist-packages
PYTHON3_EXECUTABLE /usr/bin/python3
PYTHON3_INCLUDE_DIR /usr/include/python3.6m
PYTHON3_INCLUDE_DIR2
PYTHON3_LIBRARY /usr/lib/aarch64-linux-gnu/libpython3.6m.so
PYTHON3_LIBRARY_DEBUG
PYTHON3_NUMPY_INCLUDE_DIRS /usr/lib/python3/dist-packages/numpy/core/include
PYTHON3_PACKAGES_PATH lib/python3.6/dist-packages
Qt5Concurrent_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Concurrent
Qt5Core_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Core
Qt5Gui_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Gui
Qt5OpenGL_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5OpenGL
Qt5Test_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Test
Qt5Widgets_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Widgets
Qt5_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5
TBB_DIR TBB_DIR-NOTFOUND
TBB_ENV_INCLUDE /usr/include
TBB_ENV_LIB /usr/lib/aarch64-linux-gnu/libtbb.so
TBB_ENV_LIB_DEBUG TBB_ENV_LIB_DEBUG-NOTFOUND
TBB_VER_FILE /usr/include/tbb/tbb_stddef.h
Tesseract_DIR Tesseract_DIR-NOTFOUND
Tesseract_INCLUDE_DIR Tesseract_INCLUDE_DIR-NOTFOUND
Tesseract_LIBRARY Tesseract_LIBRARY-NOTFOUND
VTK_DIR VTK_DIR-NOTFOUND
WEBP_INCLUDE_DIR WEBP_INCLUDE_DIR-NOTFOUND
WITH_1394 ON
WITH_ADE ON
WITH_ARAVIS OFF
WITH_CAROTENE ON
WITH_CLP OFF
WITH_CUBLAS ON
WITH_CUDA ON
WITH_CUDNN ON
WITH_CUFFT ON
WITH_EIGEN ON
WITH_FFMPEG ON
WITH_FREETYPE OFF
WITH_GDAL OFF
WITH_GDCM OFF
WITH_GPHOTO2 OFF
WITH_GSTREAMER ON
WITH_GTK ON
WITH_GTK_2_X OFF
WITH_HALIDE OFF
WITH_HPX OFF
WITH_IMGCODEC_HDR ON
WITH_IMGCODEC_PFM ON
WITH_IMGCODEC_PXM ON
WITH_IMGCODEC_SUNRASTER ON
WITH_INF_ENGINE OFF
WITH_ITT ON
WITH_JASPER ON
WITH_JPEG ON
WITH_LAPACK ON
WITH_LIBREALSENSE OFF
WITH_MATLAB OFF
WITH_MFX OFF
WITH_NGRAPH OFF
WITH_NVCUVID ON
WITH_OPENCL ON
WITH_OPENCLAMDBLAS ON
WITH_OPENCLAMDFFT ON
WITH_OPENCL_SVM OFF
WITH_OPENEXR ON
WITH_OPENGL ON
WITH_OPENJPEG ON
WITH_OPENMP OFF
WITH_OPENNI OFF
WITH_OPENNI2 OFF
WITH_OPENVX OFF
WITH_PLAIDML OFF
WITH_PNG ON
WITH_PROTOBUF ON
WITH_PTHREADS_PF ON
WITH_PVAPI OFF
WITH_QT ON
WITH_QUIRC ON
WITH_TBB ON
WITH_TENGINE OFF
WITH_TESSERACT ON
WITH_TIFF ON
WITH_V4L ON
WITH_VA OFF
WITH_VA_INTEL OFF
WITH_VTK ON
WITH_VULKAN OFF
WITH_WEBP ON
WITH_XIMEA OFF
WITH_XINE OFF
opencv_dnn_PERF_CAFFE OFF
opencv_dnn_PERF_CLCAFFE OFF
We can see that CUDA is enable imo but also that NVCUVID is even if I thought it was not until now
END EDIT
At last I will try the ccmake function when the current build is over and edit or post the result.
Once again thank you all for your support !!

It took me more than two weeks / dozens of hours to finally make it work (my config is similar). Here's what I did (I hope I remembered everything):
my system:
Ubuntu 18.04 on i7-4790 + GTX1050Ti (driver ver. 460.39) + CUDA 10.2 + OpenCV 4.5.1 + ffmpeg
OpenCV and ffmpeg were build with CUDA support.
OpenCV build options:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_C_COMPILER=/usr/bin/gcc-7 \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_CUDA=ON \
-D WITH_NVCUVID=ON \
-D WITH_NVCUVENC=OFF \
-D BUILD_opencv_cudacodec=ON \
-D WITH_CUDNN=OFF \
-D OPENCV_DNN_CUDA=OFF \
-D CUDA_ARCH_BIN=6.1 \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_PC_FILE_NAME=opencv4.pc \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=/usr/lib/python3.6/site-packages \
-D OPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib-4.5.1/modules \
-D PYTHON_EXECUTABLE="/usr/bin/python2" \
-D PYTHON_DEFAULT_EXECUTABLE="/usr/bin/python3" \
-D PYTHON3_EXECUTABLE="/usr/bin/python3" \
-D BUILD_EXAMPLES=ON ..
ffmpeg - I used one of many widely available tutorials on building ffmepg with CUDA support, my build looks like this:
ffmpeg version N-101174-g14dc28e969 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/home/lg/ffmpeg_build2 --pkg-config-flags=--static --extra-cflags=-I/home/lg/ffmpeg_build2/include --extra-ldflags=-L/home/lg/ffmpeg_build2/lib --extra-libs='-lpthread -lm' --bindir=/home/lg/bin2 --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-gpl --enable-opencl --enable-opengl --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libvpx --enable-libx264 --enable-libx265 --enable-nvenc --enable-vaapi --enable-vdpau --enable-nonfree --cpu=native --extra-cflags='-march=native'
Although compiling OpenCV 4.5.1 was successfull, the c++ samples using simple cv::cudacodec::createVideoReader() didn't work, the error was
The function/feature is not implemented) The called functionality is disabled for current build or platform in function 'throw_no_cuda'
I downloaded NVIDIA's Video_Codec_SDK_10.0.26 and copied nvcuvid.h, cuviddec.h and nvEncodeAPI.h from /Interface to CUDA's include dir (in my case /usr/local/cuda-10.2/targets/x86_64-linux/include) and to /usr/inlcude. It was probably not necessary to put all these files to both locations.
recompile OpenCV again. It was crucial to set these two options:
-D WITH_NVCUVID=ON \
-D BUILD_opencv_cudacodec=ON \
Without them the OpenCV didn't have NVCUVID module installed.
Compiling failed with error, it complained about cudaVideoCodec_AV1 is not declared or something similar, in file opencv_contrib-4.5.1/modules/cudacodec/src/video_decoder.cpp, line 81.
Since I didn't plan to use AV1, I simply removed this line. After this the compilation was finally successful.
Time to check the CUDA VideoReader sample - decoding H264 worked! But HEVC didn't - the error was unknown FourCC code in opencv_contrib-4.5.1/modules/cudacodec/src/ffmpeg_video_source.cpp (my video has 'hev1' FourCC).
So I added the missing definitions:
case CV_FOURCC_MACRO('H', '2', '6', '5'): // fallthru
case CV_FOURCC_MACRO('h', '2', '6', '5'): // fallthru
case CV_FOURCC_MACRO('h', 'e', 'v', 'c'): return HEVC;
changed to:
case CV_FOURCC_MACRO('H', '2', '6', '5'): // fallthru
case CV_FOURCC_MACRO('h', '2', '6', '5'): // fallthru
case CV_FOURCC_MACRO('h', 'e', 'v', '1'): // fallthru
case CV_FOURCC_MACRO('h', 'v', 'c', '1'): // fallthru
case CV_FOURCC_MACRO('h', 'e', 'v', 'c'): return HEVC;
Then recompile OpenCV for the last time and finally everything works.

(This answer is only speculative; and I'll (possibly) edit it if you post information about your CMake build log.)
OpenCV is telling you that it has no_cuda, i.e. CUDA functionality is disabled for current build or platform
That means one of two things:
Despite your "best intentions" setting a bunch of CMake flags, your OpenCV was built without CUDA support. This is quite possible, since sometimes -D values are ignored in favor of what's detected, or cannot apply without certain additional settings etc. You should try using ccmake in your build directory and see what comes up.
The build is CUDA-enabled, but OpenCV code was unable to find a CUDA driver, or the CUDA runtime library, or a usable responsive GPU etc. I'm not an OpenCV expert, but assuming it offers some logging facilities, I'd check that out. #user2986898 adds that you can get the build information at run-time using the cv::getBuildInformation() function.
It might also be useful to build the tests or examples for OpenCV and check whether those work.

Related

How fix opencv 4 compile errors on OSX

I've pulled the latest changes from the opencv repo and I'm trying to compile from source. Last time I tried this was with OpenCV 3.2.2, but this time around on 4.0 I'm getting a lot of these errors:
[ 57%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx2.cpp.o
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/core/mathfuncs_core.avx2.cpp:2:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/src/precomp.hpp:49:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/utility.hpp:56:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core.hpp:52:
/Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/cvdef.h:772:39: error: use of undeclared identifier '_mm_cvtps_ph'; did you mean '_mm_cvtss_sd'?
w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0));
^~~~~~~~~~~~
_mm_cvtss_sd
/Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/emmintrin.h:420:1: note: '_mm_cvtss_sd' declared here
_mm_cvtss_sd(__m128d __a, __m128 __b)
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/core/mathfuncs_core.avx2.cpp:2:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/src/precomp.hpp:49:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/utility.hpp:56:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core.hpp:52:
/Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/cvdef.h:772:55: error: cannot initialize a parameter of type '__m128' (vector of 4 'float' values) with an rvalue of type 'int'
w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0));
^
/Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/emmintrin.h:420:34: note: passing argument to parameter '__b' here
_mm_cvtss_sd(__m128d __a, __m128 __b)
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/core/mathfuncs_core.avx2.cpp:2:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/src/precomp.hpp:49:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/utility.hpp:56:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core.hpp:52:
/Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/cvdef.h:803:26: error: use of undeclared identifier '_mm_cvtph_ps'; did you mean '_mm_cvtpd_ps'?
_mm_store_ss(&f, _mm_cvtph_ps(_mm_cvtsi32_si128(w)));
^~~~~~~~~~~~
_mm_cvtpd_ps
/Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/emmintrin.h:376:1: note: '_mm_cvtpd_ps' declared here
_mm_cvtpd_ps(__m128d __a)
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/core/mathfuncs_core.avx2.cpp:2:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/src/precomp.hpp:85:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/hal/intrin.hpp:179:
/Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/hal/intrin_avx.hpp:2551:24: error: use of undeclared identifier '_mm256_cvtph_ps'; did you mean '_mm256_cvtpd_ps'?
return v_float32x8(_mm256_cvtph_ps(_mm_loadu_si128((const __m128i*)ptr)));
^~~~~~~~~~~~~~~
_mm256_cvtpd_ps
/Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/avxintrin.h:539:1: note: '_mm256_cvtpd_ps' declared here
_mm256_cvtpd_ps(__m256d __a)
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/core/mathfuncs_core.avx2.cpp:2:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/src/precomp.hpp:85:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/hal/intrin.hpp:179:
/Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/hal/intrin_avx.hpp:2551:40: error: cannot initialize a parameter of type '__m256d' (vector of 4 'double' values) with an rvalue of type '__m128i' (vector of 2 'long long' values)
return v_float32x8(_mm256_cvtph_ps(_mm_loadu_si128((const __m128i*)ptr)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/avxintrin.h:539:25: note: passing argument to parameter '__a' here
_mm256_cvtpd_ps(__m256d __a)
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/core/mathfuncs_core.avx2.cpp:2:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/src/precomp.hpp:85:
In file included from /Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/hal/intrin.hpp:179:
/Users/George/Downloads/Grouped/cv/opencv/modules/core/include/opencv2/core/hal/intrin_avx.hpp:2556:18: error: use of undeclared identifier '_mm256_cvtps_ph'
__m128i ah = _mm256_cvtps_ph(a.val, 0);
^
6 errors generated.
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx2.cpp.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
I'm on OSX 10.11.6 using Xcode 7.0 and this is the cmake output:
-- Looking for ccache - not found
-- FP16 is not supported by C++ compiler
-- AVX_512F is not supported by C++ compiler
-- AVX512_SKX is not supported by C++ compiler
-- Dispatch optimization FP16 is not available, skipped
-- Dispatch optimization AVX512_SKX is not available, skipped
-- libjpeg-turbo: VERSION = 1.5.3, BUILD = opencv-4.0.0-dev-libjpeg-turbo
-- Checking for module 'gstreamer-base-1.0'
-- No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
-- No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
-- No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
-- No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
-- No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
-- No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
-- No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
-- No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
-- No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
-- No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
-- No package 'libdc1394-2' found
-- Checking for module 'libdc1394'
-- No package 'libdc1394' found
-- found Intel IPP (ICV version): 2019.0.0 [2019.0.0 Gold]
-- at: /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/3rdparty/ippicv/ippicv_mac/icv
-- Cannot find Intel IPP Integration Wrappers, optimizations will be limited. Use IPPIWROOT to set custom location
-- Found apache ant: /usr/local/bin/ant (1.9.7)
-- Found VTK 7.1.1 (/usr/local/Cellar/vtk/7.1.1_1/lib/cmake/vtk-7.1/UseVTK.cmake)
-- OpenCV Python: during development append to PYTHONPATH: /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/python_loader
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /Users/George/Downloads/Grouped/cv/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out ocl4dnn source code
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
--
-- General configuration for OpenCV 4.0.0-dev =====================================
-- Version control: 4.0.0-29-g02cc1cd
--
-- Platform:
-- Timestamp: 2018-11-23T11:45:27Z
-- Host: Darwin 15.6.0 x86_64
-- CMake: 3.12.4
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: Release
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3 SSSE3
-- requested: DETECT
-- Dispatched code generation: SSE4_1 SSE4_2 AVX AVX2
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (5 files): + SSE4_1
-- SSE4_2 (1 files): + SSE4_1 POPCNT SSE4_2
-- AVX (4 files): + SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (11 files): + SSE4_1 POPCNT SSE4_2 FMA3 AVX AVX2
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ (ver 7.0.0.7000072)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -g1
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /Applications/IDEsAndEditors/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -g1
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies:
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java java_bindings_generator ml objdetect photo python_bindings_generator stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: js python2 python3
-- Applications: apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- Cocoa: YES
-- VTK support: YES (ver 7.1.1)
--
-- Media I/O:
-- ZLib: build (ver 1.2.11)
-- JPEG: build-libjpeg-turbo (ver 1.5.3-62)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: build (ver 1.6.35)
-- TIFF: build (ver 42 - 4.0.9)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: YES
-- avcodec: YES (ver 57.89.100)
-- avformat: YES (ver 57.71.100)
-- avutil: YES (ver 55.58.100)
-- swscale: YES (ver 4.6.100)
-- avresample: YES (ver 3.5.0)
-- GStreamer: NO
-- AVFoundation: YES
--
-- Parallel framework: GCD
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2019.0.0 Gold [2019.0.0]
-- at: /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/3rdparty/ippicv/ippicv_mac/icv
-- Intel IPP IW: NO
-- Eigen: YES (ver 3.3.4)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: NO
-- Link libraries: -framework OpenCL
--
-- Python (for build): /usr/local/bin/python2.7
--
-- Java:
-- ant: /usr/local/bin/ant (ver 1.9.7)
-- JNI: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/include /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/include/darwin /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/include
-- Java wrappers: YES
-- Java tests: NO
--
-- Install to: /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/install
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava
I thought this was related to Accelerate/BLAS/LAPACK and I've set WITH_LAPACK to OFF, but the errors persist.
Any clues on what I should look out for ?
Update I've re-read the errors and they are related to AVX2 CPU instructions.
I remember AVX2 optimisations used to work with 3.2.2, but I've disabled them for now and I could compile.
Ran into some errors building the emscripten js module:
[ 97%] Building CXX object modules/js/CMakeFiles/opencv_js.dir/bindings.cpp.o
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/js/bindings.cpp:71:
In file included from /Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:10:
In file included from /Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/val.h:4:
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/wire.h:383:37: warning: declaration shadows a field of 'memory_view<ElementType>' [-Wshadow]
explicit memory_view(size_t size, const ElementType* data)
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/wire.h:388:22: note: previous declaration is here
const size_t size; // in elements, not bytes
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/wire.h:383:62: warning: declaration shadows a field of 'memory_view<ElementType>' [-Wshadow]
explicit memory_view(size_t size, const ElementType* data)
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/wire.h:389:27: note: previous declaration is here
const void* const data;
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/js/bindings.cpp:71:
In file included from /Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:10:
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/val.h:173:9: error: static_assert failed "GenericWireType must be 8 bytes"
static_assert(sizeof(GenericWireType) == 8, "GenericWireType must be 8 bytes");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/val.h:439:39: warning: declaration shadows a field of 'emscripten::val' [-Wshadow]
explicit val(internal::EM_VAL handle)
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/val.h:464:26: note: previous declaration is here
internal::EM_VAL handle;
^
In file included from /Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/js/bindings.cpp:71:
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:841:34: warning: unused parameter 'v' [-Wunused-parameter]
static void* share(void* v) {
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:887:38: warning: declaration shadows a field of 'emscripten::smart_ptr_trait<shared_ptr<type-parameter-0-0> >::val_deleter' [-Wshadow]
explicit val_deleter(val v)
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:896:17: note: previous declaration is here
val v;
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:924:32: warning: declaration shadows a field of 'wrapper<T>' [-Wshadow]
explicit wrapper(val&& wrapped, Args&&... args)
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:941:13: note: previous declaration is here
val wrapped;
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:1010:20: error: cannot cast 'cv::Algorithm *' to 'cv::Feature2D *' via virtual base 'cv::Algorithm'
return static_cast<To*>(ptr);
^~~~~~~~~~~~~~~~~~~~~
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:1005:21: note: in instantiation of function template specialization 'emscripten::base<cv::Algorithm>::convertPointer<cv::Algorithm, cv::Feature2D>' requested here
return &convertPointer<BaseClass, ClassType>;
^
/Users/George/Downloads/Libraries/emsdk_portable/emscripten/1.35.0/system/include/emscripten/bind.h:1070:53: note: in instantiation of function template specialization 'emscripten::base<cv::Algorithm>::getDowncaster<cv::Feature2D>' requested here
auto downcast = BaseSpecifier::template getDowncaster<ClassType>();
^
/Users/George/Downloads/Grouped/cv/opencv/buildDNNJava/modules/js/bindings.cpp:3470:5: note: in instantiation of member function 'emscripten::class_<cv::Feature2D, emscripten::base<cv::Algorithm> >::class_' requested here
emscripten::class_<cv::Feature2D ,base<Algorithm>>("Feature2D")
^
6 warnings and 2 errors generated.
so I'd be happy to hear more about how to get past these and maybe enable AVX instructions.

compile old qt version

I'm working on a project with Qt. I have download and compile my Qt 4.8.7 version without problems on Ubuntu 14.04 and Ubuntu 16.04.
I have followed the next steps:
Install cross compilation tools and package dependencies
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install g++-multilib
sudo apt-get build-dep qt4-x11
Download Qt
mkdir -p ~/dmi/dep/qt && cd ~/dmi/dep/qt
wget http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
tar xvzf qt-everywhere-opensource-src-4.8.7.tar.gz
cd qt-everywhere-opensource-src-4.8.7
Configure, compile and install Qt for the host system
./configure -prefix $HOME/dmi/dep/install/amd64 -embedded -static \
-nomake docs -nomake examples -nomake demos -no-openssl \
-no-qt3support -no-phonon -no-phonon-backend -no-webkit \
-no-javascript-jit -no-script -no-scripttools -no-cups -qvfb \
-qt-gfx-linuxfb -qt-gfx-qvfb -opensource -confirm-license
make -j 5
make install
As I said... This is working perfectly with qt 4.8.7. Now I'm trying to the the same with an old Qt version 4.6.4. But It doesn't work. This is the ./configure output:
Build ............... libs tools translations
Configuration ....... release static embedded largefile precompile_header mmx 3dnow sse sse2 exceptions_off minimal-config small-config medium-config large-config full-config accessibility embedded reduce_exports ipv6 clock-gettime clock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify system-jpeg jpeg mng system-png png gif system-tiff tiff system-freetype system-zlib nis glib dbus multimedia audio-backend svg release
Debug ............... no
Qt 3 compatibility .. no
QtDBus module ....... yes (run-time)
QtConcurrent code.... yes
QtScript module ..... no
QtScriptTools module no
QtXmlPatterns module no
Phonon module ....... no
Multimedia module ... yes
SVG module .......... yes
WebKit module ....... no
Declarative module .. no
STL support ......... no
PCH support ......... yes
MMX/3DNOW/SSE/SSE2.. yes/yes/yes/yes
IPv6 support ........ yes
IPv6 ifname support . yes
getaddrinfo support . yes
getifaddrs support .. yes
Accessibility ....... yes
NIS support ......... yes
CUPS support ........ no
Iconv support ....... no
Glib support ........ yes
GStreamer support ... auto
Large File support .. yes
GIF support ......... yes
TIFF support ........ yes (system)
JPEG support ........ yes (system)
PNG support ......... yes (system)
MNG support ......... yes (qt)
zlib support ........ system
Session management .. no
Embedded support .... x86_64
Freetype2 support ... auto (system)
Graphics (qt) ....... linuxfb multiscreen qvfb linuxfb qvfb
Graphics (plugin) ...
Decorations (qt) .... styled windows default
Decorations (plugin)
Keyboard driver (qt). tty qvfb
Keyboard driver (plugin)
Mouse driver (qt) ... pc linuxtp qvfb
Mouse driver (plugin)
OpenGL support ...... no
OpenVG support ...... no
MySQL support ....... plugin
PostgreSQL support .. plugin
ODBC support ........ plugin
TDS support ......... plugin
SQLite support ...... plugin (qt)
OpenSSL support ..... no
Alsa support ........ no
WARNING: Using static linking will disable the use of dynamically
loaded plugins. Make sure to import all needed static plugins,
or compile needed modules into the library.
Finding project files. Please wait...
Reading /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/src/tools/bootstrap/bootstrap.pro
...
Reading /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/translations/translations.pro
790 projects found.
Creating makefiles. Please wait...
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/tools/qtestlib/wince/remotelib/remotelib.pro
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/tools/designer/src/components/lib/lib.pro
potential duplicate alias detected: 'widget.png'
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/tools/assistant/lib/lib.pro
...
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/src/plugins/phonon/gstreamer/gstreamer.pro
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/src/plugins/phonon/mmf/mmf.pro
Error: Symbian SDK registry key not found
Error: failed to find epoc root
Either
1. Set EPOCROOT environment variable to a valid value
or 2. Ensure that the HKEY_LOCAL_MACHINE\Software\Symbian\EPOC SDKs\CommonPath registry key is set, and then
a. Set EPOCDEVICE environment variable to a valid device
or b. Specify a default device in the devices.xml file.
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/src/plugins/phonon/waveout/waveout.pro
...
for /home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /home/xabi/dmi/dep/install/amd64
To reconfigure, run 'make confclean' and 'configure'.
And the make fails:
64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/qws/linux-x86_64-g++ -I. -I../../include/QtCore -I../../include/QtNetwork -I../../include -I../../include/QtGui -I.rcc/release-static-emb-x86_64 -I/usr/include/freetype2 -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-static-emb-x86_64 -I.uic/release-static-emb-x86_64 -o .obj/release-static-emb-x86_64/qheaderview.o itemviews/qheaderview.cpp
itemviews/qabstractitemview.cpp: In member function ‘virtual void QAbstractItemView::keyPressEvent(QKeyEvent*)’:
itemviews/qabstractitemview.cpp:2311:10: error: ‘Key_BackSpace’ is not a member of ‘Qt’
case Qt::Key_BackSpace:
^
g++ -c -include .pch/release-static-emb-x86_64/QtGui -pipe -m64 -fno-exceptions -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_NO_FONTCONFIG -DQT_NO_OPENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_GTK -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/qws/linux-x86_64-g++ -I. -I../../include/QtCore -I../../include/QtNetwork -I../../include -I../../include/QtGui -I.rcc/release-static-emb-x86_64 -I/usr/include/freetype2 -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-static-emb-x86_64 -I.uic/release-static-emb-x86_64 -o .obj/release-static-emb-x86_64/qlistview.o itemviews/qlistview.cpp
Makefile:126493: recipe for target '.obj/release-static-emb-x86_64/qabstractitemview.o' failed
make[1]: *** [.obj/release-static-emb-x86_64/qabstractitemview.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/xabi/dmi/dep/qt/qt-everywhere-opensource-src-4.6.4/src/gui'
Makefile:306: recipe for target 'sub-gui-make_default-ordered' failed
make: *** [sub-gui-make_default-ordered] Error 2
What's the problem? Any idea?

OpenCV3.3 CUDA stack smashing

I installed OpenCV3.3 with CUDA in ubuntu 16.04.
I tried to build OpenCV with CUDA sample code.
Code compile succeeded but I faced following error message when I executed binary.
error message is "* stack smashing detected *: ./test terminated
Aborted (core dumped)"
I want to delete this error message. How do I fix code or settings ?
my test code is
#include <opencv2/core.hpp>
#include <opencv2/core/cuda.hpp>
#include <opencv2/imgcodecs.hpp>
#include <iostream>
using namespace cv;
int main(int argc, const char* argv[])
{
// view OpenCV build information
std::cout << cv::getBuildInformation() << std::endl;
// view CUDA infomation
int dev_id = cv::cuda::getDevice();
std::cout << "cuda get device id is " << dev_id << " getCudaEnabledDeviceCount is " << cv::cuda::getCudaEnabledDeviceCount() << std::endl;
cv::cuda::setDevice(dev_id);
cv::cuda::printCudaDeviceInfo(dev_id);
cv::cuda::resetDevice();
}
and message
----------
General configuration for OpenCV 3.3.0 =====================================
Version control: unknown
Platform:
Timestamp: 2017-08-23T01:49:09Z
Host: Linux 4.10.0-32-generic x86_64
CMake: 3.5.1
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
requested: SSE4_1 SSE4_2 AVX FP16 AVX2
SSE4_1 (2 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 5.4.0)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef dow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -mssisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef dow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -mssisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissin-Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse-DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissin-Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse-O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: /usr/lib/x86_64-linux-gnu/libcuda.so /usr/lib/libnvcuvid.so Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent Qt5::OpenGL /usr/lib/x86_64-linux-gnu/libpng.so /usr//lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-li-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so gstbase-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 gstvideo-1.0 gstapp-1.0 gstriff-1.0 gstpbutils-1.0 dc1394 avcodec-ffmpeg avformat-ffmpeg avutle-ffmpeg dl m pthread rt /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libtbb.so cudart nppc nppi npps cublas cufft -L/usr/local/cuda-8.0/lib64
3rdparty dependencies:
OpenCV modules:
To be built: cudev core cudaarithm flann imgproc ml objdetect video cudabgsegm cudafilters cudaimgproc cudawarping dnn imgcodecs photo shape videoio cudacodec highgui features2d calib3bjdetect cudaoptflow cudastereo stitching superres videostab python3
Disabled: world
Disabled by dependency: -
Unavailable: java python2 ts viz
GUI:
QT 5.x: YES (ver 5.5.1)
QT OpenGL support: YES (Qt5::OpenGL 5.5.1)
OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so)
VTK support: NO
Media I/O:
ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
WEBP: build (ver encoder: 0x020e)
PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
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
GDAL: NO
GDCM: NO
Video I/O:
DC1394 1.x: NO
DC1394 2.x: YES (ver 2.2.4)
FFMPEG: YES
avcodec: YES (ver 56.60.100)
avformat: YES (ver 56.40.101)
avutil: YES (ver 54.31.100)
swscale: YES (ver 3.1.101)
avresample: YES (ver 2.1.0)
GStreamer:
base: YES (ver 1.8.3)
video: YES (ver 1.8.3)
app: YES (ver 1.8.3)
riff: YES (ver 1.8.3)
pbutils: YES (ver 1.8.3)
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
Aravis SDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/YES
XIMEA: NO
Xine: NO
Intel Media SDK: NO
gPhoto2: NO
Parallel framework: TBB (ver 4.4 interface 9002)
Trace: YES (with Intel ITT)
Other third-party libraries:
Use Intel IPP: 2017.0.2 [2017.0.2]
at: /home/test/OpenCv/opencv-3.3.0/build/3rdparty/ippicv/ippicv_lnx
Use Intel IPP IW: prebuilt binaries (2017.0.2)
Use Intel IPP Async: NO
Use VA: NO
Use Intel VA-API/OpenCL: NO
Use Lapack: NO
Use Eigen: YES (ver 3.2.92)
Use Cuda: YES (ver 8.0)
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: YES
USE NVCUVID: YES
NVIDIA GPU arch: 20 30 35 37 50 52 60 61
NVIDIA PTX archs:
Use fast math: YES
OpenCL: <Dynamic loading of OpenCL library>
Include path: /home/test/OpenCv/opencv-3.3.0/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.12)
Python 3:
Interpreter: /usr/bin/python3 (ver 3.5.2)
Libraries: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
numpy: /usr/local/lib/python3.5/dist-packages/numpy/core/include (ver 1.13.1)
packages path: lib/python3.5/dist-packages
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Documentation:
Doxygen: NO
Tests and samples:
Tests: NO
Performance tests: NO
C/C++ Examples: YES
Install path: /usr/local
cvconfig.h is in: /home/test/OpenCv/opencv-3.3.0/build
-----------------------------------------------------------------
cuda get device id is 0 getCudaEnabledDeviceCount is 1
*** CUDA Device Query (Runtime API) version (CUDART static linking) ***
Device count: 1
Device 0: "GeForce GTX 1080"
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 6.1
Total amount of global memory: 8112 MBytes (8506048512 bytes)
GPU Clock Speed: 1.73 GHz
Max Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072,65536), 3D=(16384,16384,16384)
Max Layered Texture Size (dim) x layers 1D=(32768) x 2048, 2D=(32768,32768) x 2048
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per block: 1024
Maximum sizes of each dimension of a block: 1024 x 1024 x 64
Maximum sizes of each dimension of a grid: 2147483647 x 65535 x 65535
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and execution: Yes with 2 copy engine(s)
Run time limit on kernels: No
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Concurrent kernel execution: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support enabled: No
Device is using TCC driver mode: No
Device supports Unified Addressing (UVA): Yes
Device PCI Bus ID / PCI location ID: 2 / 0
Compute Mode:
Default (multiple host threads can use ::cudaSetDevice() with device simultaneously)
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1
*** stack smashing detected ***: ./test terminated
Aborted (core dumped)
----------
How fixed this error?
I get "stack smashing" quite often. The CUDA code is in a static library, linked in a simple CLI executable. A Clean Rebuild always makes it go away. I suspect my IDE is not rebuilding and relinking edited files as it should.

C++ headers not found on OSX Sierra

I'm trying to compile a program using CMake and I'm getting the following output:
make VERBOSE=1
Re-run cmake no build system arguments
-- Found ccache /usr/local/osquery/bin/ccache
-- Using ccache to speed up compilation
-- The C compiler identification is Clang 3.8.0
-- The CXX compiler identification is Clang 3.8.0
-- Check for working C compiler: /usr/local/bin/clang
-- Check for working C compiler: /usr/local/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/clang++
-- Check for working CXX compiler: /usr/local/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Welcome to osquery's build-- thank you for your patience! :)
-- For a brief tutorial see: http://osquery.readthedocs.io/en/stable/development/building/
-- If at first you dont succeed, perhaps: make distclean; make depsclean
-- Building for platform OS X (darwin, 10.12)
-- Building osquery version 1.6.2-801-gd402a6a sdk 1.6.2
-- Looking for C++ include tr1/tuple
-- Looking for C++ include tr1/tuple - not found
-- Found PythonInterp: /usr/local/osquery/bin/python (found version "2.7.12")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found library /usr/lib/libpthread.dylib
-- Found library /usr/lib/libz.dylib
-- Found library /usr/local/osquery/lib/libboost_system-mt.a
-- Found library /usr/local/osquery/lib/libboost_filesystem-mt.a
-- Found library /usr/local/osquery/lib/libgflags.a
-- Found library /usr/local/osquery/lib/libthrift.a
-- Found library /usr/local/osquery/lib/liblz4.a
-- Found library /usr/local/osquery/lib/libglog.a
-- Found library /usr/lib/libdl.dylib
-- Found library /usr/local/osquery/lib/libcppnetlib-uri.a
-- Found library /usr/local/osquery/lib/libcppnetlib-client-connections.a
-- Found library /usr/local/osquery/lib/libboost_regex-mt.a
-- Found library /usr/local/osquery/lib/librocksdb_lite.a
-- Found library /usr/local/osquery/lib/libsnappy.a
-- Found library /usr/local/osquery/lib/libssl.a
-- Found library /usr/local/osquery/lib/libyara.a
-- Found library /usr/local/osquery/lib/libcrypto.a
-- Found library /usr/local/osquery/lib/liblinenoise.a
-- Found library /usr/lib/liblzma.dylib
-- Found library /usr/lib/libbz2.dylib
-- Found library /usr/local/osquery/lib/libaws-cpp-sdk-kinesis.a
-- Found library /usr/local/osquery/lib/libaws-cpp-sdk-firehose.a
-- Found library /usr/local/osquery/lib/libaws-cpp-sdk-sts.a
-- Found library /usr/local/osquery/lib/libaws-cpp-sdk-core.a
-- Found library /usr/lib/libresolv.dylib
-- Found library /usr/lib/libxar.dylib
-- Found library /usr/local/osquery/lib/libmagic.a
-- Found library /usr/local/osquery/lib/libtsk.a
-- Found library /usr/local/osquery/lib/libaugeas.a
-- Found library /usr/local/osquery/lib/libfa.a
-- Found library /usr/local/osquery/lib/libxml2.a
-- Found library /usr/lib/libiconv.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/omer.katz/Documents/osquery/build/darwin10.12
/usr/local/osquery/Cellar/cmake/3.6.1_1/bin/cmake -H/Users/omer.katz/Documents/osquery -B/Users/omer.katz/Documents/osquery/build/darwin10.12 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/osquery/Cellar/cmake/3.6.1_1/bin/cmake -E cmake_progress_start /Users/omer.katz/Documents/osquery/build/darwin10.12/CMakeFiles /Users/omer.katz/Documents/osquery/build/darwin10.12/CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make -f third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/build.make third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/depend
cd /Users/omer.katz/Documents/osquery/build/darwin10.12 && /usr/local/osquery/Cellar/cmake/3.6.1_1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/omer.katz/Documents/osquery /Users/omer.katz/Documents/osquery/third-party/sqlite3 /Users/omer.katz/Documents/osquery/build/darwin10.12 /Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3 /Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/DependInfo.cmake --color=
Dependee "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/DependInfo.cmake" is newer than depender "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/depend.internal".
Dependee "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/depend.internal".
Scanning dependencies of target osquery_sqlite
/Library/Developer/CommandLineTools/usr/bin/make -f third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/build.make third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/build
[ 0%] Building C object third-party/sqlite3/CMakeFiles/osquery_sqlite.dir/sqlite3.c.o
cd /Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/sqlite3 && /usr/local/osquery/bin/ccache /usr/local/bin/clang -DBOOST_NETWORK_ENABLE_HTTPS -DBOOST_NO_CXX11_VARIADIC_TEMPLATES -DDARWIN -DDARWIN_10_12 -DNDEBUG -DOSQUERY_BUILD_DISTRO=10.12 -DOSQUERY_BUILD_PLATFORM=darwin -DOSQUERY_BUILD_SDK_VERSION=1.6.2 -DOSQUERY_THRIFT="" -DOSQUERY_THRIFT_LIB=thrift -DOSQUERY_THRIFT_POINTER=boost -DOSQUERY_THRIFT_SERVER_LIB=thrift/server -DSQLITE_DISABLE_DIRSYNC -DSQLITE_DISABLE_FTS3_UNICODE -DSQLITE_DISABLE_FTS4_DEFERRED -DSQLITE_DISABLE_LFS -DSQLITE_ENABLE_API_ARMOR -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_OMIT_AUTHORIZATION -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_LOOKASIDE -DSQLITE_OMIT_SHARED_CACHE -DSTRIP_FLAG_HELP=1 -isystem /Users/omer.katz/Documents/osquery/third-party/sysroots/darwin -isystem /usr/local/osquery/legacy/include -isystem /usr/local/osquery/include -I/usr/local/osquery/include/openssl -I/Users/omer.katz/Documents/osquery/third-party/sqlite3 -I/Users/omer.katz/Documents/osquery/include -I/Users/omer.katz/Documents/osquery -I/Users/omer.katz/Documents/osquery/build/darwin10.12/generated/gen-cpp -Qunused-arguments -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-local-typedef -Wno-deprecated-register -Wno-unknown-warning-option -Wnon-virtual-dtor -Wchar-subscripts -Wpointer-arith -Woverloaded-virtual -Wformat -Wformat-security -Werror=format-security -Wabi-tag -fpermissive -fstack-protector-all -pipe -fdata-sections -ffunction-sections -mmacosx-version-min=10.12 -Os -fPIE -fpie -fPIC -fpic -march=x86-64 -mno-avx -Wno-parentheses-equality -Wno-unused-value -o CMakeFiles/osquery_sqlite.dir/sqlite3.c.o -c /Users/omer.katz/Documents/osquery/third-party/sqlite3/sqlite3.c
/Users/omer.katz/Documents/osquery/third-party/sqlite3/sqlite3.c:20330:17: warning: 'OSAtomicCompareAndSwapPtrBarrier' is deprecated: first deprecated in OS X 10.12 - Use atomic_compare_exchange_strong() from <stdatomic.h> instead [-Wdeprecated-declarations]
success = OSAtomicCompareAndSwapPtrBarrier(NULL, newzone,
^
/usr/include/libkern/OSAtomicDeprecated.h:547:6: note: 'OSAtomicCompareAndSwapPtrBarrier' has been explicitly marked deprecated here
bool OSAtomicCompareAndSwapPtrBarrier( void *__oldValue, void *__newValue, void * volatile *__theValue );
^
1 warning generated.
[ 0%] Built target osquery_sqlite
/Library/Developer/CommandLineTools/usr/bin/make -f third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/build.make third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/depend
cd /Users/omer.katz/Documents/osquery/build/darwin10.12 && /usr/local/osquery/Cellar/cmake/3.6.1_1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/omer.katz/Documents/osquery /Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0 /Users/omer.katz/Documents/osquery/build/darwin10.12 /Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0 /Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/DependInfo.cmake --color=
Dependee "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/DependInfo.cmake" is newer than depender "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/depend.internal".
Dependee "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/depend.internal".
Scanning dependencies of target gmock_main
/Library/Developer/CommandLineTools/usr/bin/make -f third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/build.make third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/build
[ 0%] Building CXX object third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/gtest/src/gtest-all.cc.o
cd /Users/omer.katz/Documents/osquery/build/darwin10.12/third-party/gmock-1.7.0 && /usr/local/osquery/bin/ccache /usr/local/bin/clang++ -DBOOST_NETWORK_ENABLE_HTTPS -DBOOST_NO_CXX11_VARIADIC_TEMPLATES -DDARWIN -DDARWIN_10_12 -DNDEBUG -DOSQUERY_BUILD_DISTRO=10.12 -DOSQUERY_BUILD_PLATFORM=darwin -DOSQUERY_BUILD_SDK_VERSION=1.6.2 -DOSQUERY_THRIFT="" -DOSQUERY_THRIFT_LIB=thrift -DOSQUERY_THRIFT_POINTER=boost -DOSQUERY_THRIFT_SERVER_LIB=thrift/server -DSTRIP_FLAG_HELP=1 -isystem /Users/omer.katz/Documents/osquery/third-party/sysroots/darwin -isystem /usr/local/osquery/legacy/include -isystem /usr/local/osquery/include -I/usr/local/osquery/include/openssl -I/Users/omer.katz/Documents/osquery/third-party/sqlite3 -I/Users/omer.katz/Documents/osquery/include -I/Users/omer.katz/Documents/osquery -I/Users/omer.katz/Documents/osquery/build/darwin10.12/generated/gen-cpp -I/Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0/include -I/Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0 -I/Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0/gtest/include -I/Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0/gtest -L/usr/local/osquery/lib -L/usr/local/osquery/lib -DGTEST_HAS_PTHREAD=1 -Qunused-arguments -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-local-typedef -Wno-deprecated-register -Wno-unknown-warning-option -Wnon-virtual-dtor -Wchar-subscripts -Wpointer-arith -Woverloaded-virtual -Wformat -Wformat-security -Werror=format-security -Wabi-tag -fpermissive -fstack-protector-all -pipe -fdata-sections -ffunction-sections -mmacosx-version-min=10.12 -Os -fPIE -fpie -fPIC -fpic -march=x86-64 -mno-avx -o CMakeFiles/gmock_main.dir/gtest/src/gtest-all.cc.o -c /Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0/gtest/src/gtest-all.cc
In file included from /Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0/gtest/src/gtest-all.cc:39:
/Users/omer.katz/Documents/osquery/third-party/gmock-1.7.0/gtest/include/gtest/gtest.h:54:10: fatal error: 'limits' file not found
#include <limits>
^
1 error generated.
make[3]: *** [third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/gtest/src/gtest-all.cc.o] Error 1
make[2]: *** [third-party/gmock-1.7.0/CMakeFiles/gmock_main.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
XCode is installed correctly
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
and the header files are present.
What could be the issue? Is it an environment variable that I need to set?
This is over a year old, and the osquery build system has improved. Doing a 'make dep && make' will get all dependencies and build osqueryi/osqueryd. It takes a good long while, but it's pretty solid.
/usr/local/bin/clang is not a standard location for the system clang installation.
It looks like you have a corrupt installation there maybe. Try the one in /usr/bin and see if you have better luck.
Or download a fresh build here: http://llvm.org/releases/download.html
I can confirm the 3.9 build is an "unzip and go" and it works on Sierra.

OpenCV with xcode error: Undefined symbols for architecture x86_64:

I'm trying to install opencv and use it with xCode for making application in C++.
I installed it using macports and follow many tutorials to do it. I have done the linking too in xcode but there is problems that some function dosen't work. it give an error like Undefined symbols for architecture x86_64:
cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)",
"cv::floodFill(cv::_OutputArray const&, cv::Point_<int>, cv::Scalar_<double>, cv::Rect_<int>*, cv::Scalar_<double>, cv::Scalar_<double>, int)
If I switch the build arch to 32 bits, it gives the same error with more functions.
any idea ? I try to delete macports with opencv and install it using homebrew in 32 bits build but homebrew cannot install it for unknown error. so is the library not 64 bits compatible ?
I got OpenCV 2.3.0 installed on my Mac through my favorite way, which is download the source code and compile it:
tar -xzvf OpenCV-2.3.0.tar.bz2
cd OpenCV-2.3.0
mkdir build
cd build
cmake ../
-- Extracting svn version, please wait...
-- SVNVERSION:
-- Detected version of GNU GCC: 42 (402)
-- checking for module 'libdc1394-2'
-- package 'libdc1394-2' not found
-- checking for module 'libdc1394'
-- package 'libdc1394' not found
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.3")
-- Found PythonInterp: /usr/bin/python2.6 (found version "2.6.1")
-- Use NumPy headers from: /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named sphinx
-- CUDA detected: 4.0
-- CUDA NVCC target flags: -gencode;arch=compute_11,code=sm_11;-gencode;arch=compute_12,code=sm_12;-gencode;arch=compute_13,code=sm_13;-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_20,code=compute_20
-- Parsing 'cvconfig.h.cmake'
--
-- General configuration for opencv 2.3.0 =====================================
--
-- Built as dynamic libs?: ON
-- Compiler:
-- C++ flags (Release): -m32 -Wall -pthread -march=i386 -O3 -DNDEBUG -fomit-frame-pointer -ffast-math -msse -msse2 -DNDEBUG
-- C++ flags (Debug): -m32 -Wall -pthread -march=i386 -g -O0 -DDEBUG -D_DEBUG -ggdb3
-- Linker flags (Release):
-- Linker flags (Debug):
--
-- GUI:
-- Cocoa: YES
--
-- Media I/O:
-- ZLib: TRUE
-- JPEG: TRUE
-- PNG: TRUE
-- TIFF: TRUE
-- JPEG 2000: TRUE
-- OpenEXR: NO
-- OpenNI: FALSE
--
-- Video I/O: QTKit
--
-- Interfaces:
-- Python: ON
-- Python interpreter: /usr/bin/python2.6
-- Python numpy: YES
-- Use IPP: NO
-- Use TBB: NO
-- Use ThreadingFramework: NO
-- Use Cuda: YES
-- Use Eigen: NO
--
-- Documentation:
-- Build Documentation: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /Users/karlphillip/installers/OpenCV-2.3.0/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/karlphillip/installers/OpenCV-2.3.0/build
Then:
make
sudo make install
And there it is:
$ pkg-config --cflags --libs opencv
-I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
Note: if you need to install any dependencies, use brew!
And all OpenCV libs are x86_64:
$ file /usr/local/lib/libopencv_highgui.dylib
/usr/local/lib/libopencv_highgui.dylib: Mach-O 64-bit dynamically linked shared library x86_64
$ file /usr/local/lib/libopencv_imgproc.dylib
/usr/local/lib/libopencv_imgproc.dylib: Mach-O 64-bit dynamically linked shared library x86_64
I suggest you remove the current OpenCV installation and make sure there is nothing left in your system before downloading and compiling it from scratch.