mdegans / nano_build_opencv Goto Github PK
View Code? Open in Web Editor NEWBuild OpenCV on Nvidia Jetson Nano
License: MIT License
Build OpenCV on Nvidia Jetson Nano
License: MIT License
E: Package 'cmake' has no installation candidate
E: Package 'libdc1394-22-dev' has no installation candidate
E: Package 'libgtk2.0-dev' has no installation candidate
E: Unable to locate package libv4l-dev
E: Package 'python3-numpy' has no installation candidate
Hi mdegans,
First, I would like to thank you very much for providing this script. It allowed me to install opencv 4.4 flawlessly on my jetson nano jetpack 4.4, so really, thank you!
I'm trying to make an old piece of code to work on my jetson nano as well, and this project uses opencv 3.2.0.
I decided to try your script to install this opencv version but unfortunately it fails, after some time.
The fail seems to be related to cmake configuration, but as I have no knowledge of cmake, I'm struggling to find the reason why.
If by chance you have some free time and you would like to help me use your script to install opencv 3.2.0, here is a link to my terminal output, the CMakeOutput.log and the CMakeError.log
Thank you, happy new year!
Laurent
Originally posted by @lweingart in #12 (comment)
Trying to build latest OpenCV (4.2.0) on Jetson Nano (Jetpack 4.3 / L4T 32.3.1), but it fails at opencv_visualisation:
Scanning dependencies of target opencv_visualisation
[ 75%] Building CXX object apps/visualisation/CMakeFiles/opencv_visualisation.dir/opencv_visualisation.cpp.o
[ 76%] Building CXX object modules/dpm/CMakeFiles/opencv_dpm.dir/src/dpm_model.cpp.o
[ 76%] Linking CXX executable ../../bin/opencv_visualisation
../../lib/libopencv_videoio.so.4.2.0: undefined reference to `av_packet_unref'
../../lib/libopencv_videoio.so.4.2.0: undefined reference to `avformat_get_mov_video_tags'
collect2: error: ld returned 1 exit status
apps/visualisation/CMakeFiles/opencv_visualisation.dir/build.make:100: recipe for target 'bin/opencv_visualisation' failed
make[2]: *** [bin/opencv_visualisation] Error 1
CMakeFiles/Makefile2:6929: recipe for target 'apps/visualisation/CMakeFiles/opencv_visualisation.dir/all' failed
make[1]: *** [apps/visualisation/CMakeFiles/opencv_visualisation.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Thanks in advance.
Hi,
Could not download 2.4 branch with the script.
with
sudo ./build_opencv.sh 2.4
fatal: Remote branch 2.4 not found in upstream origin
I have checked that the 2.4 branch exists.
I have installed successfully opencv on my jetson nano, but my purpose is to create a wheel file and install it in docker container, in order not to rebuild in every time. Is this possible?
The OpenCV maintainers will have to fix this.
The same issue as here.
Thank you very much for your help.
Now I'm trying to use cuDNN on my Jetson nano, but build is not successable.
I've eddited your build_opencv.sh just these 2 lines,
111 -D CUDA_ARCH_BIN=5.3
112 -D CUDA_ARCH_PTX=5.3
and I've ran this script.
sudo ./build_opencv.sh
Then I got these Output.
[ 46%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/blank_layer.cpp.o
In file included from /tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/csl/cudnn.hpp:8:0,
from /tmp/build_opencv/opencv/modules/dnn/src/layers/…/op_cuda.hpp:11,
from /tmp/build_opencv/opencv/modules/dnn/src/layers/blank_layer.cpp:43:
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/convolution.hpp: In constructor ‘cv::dnn::cuda4dnn::csl::cudnn::ConvolutionAlgorithm::ConvolutionAlgorithm(const cv::dnn::cuda4dnn::csl::cudnn::Handle&, const cv::dnn::cuda4dnn::csl::cudnn::ConvolutionDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::FilterDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&)’:
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/convolution.hpp:266:21: error: ‘CUDNN_CONVOLUTION_FWD_PREFER_FASTEST’ was not declared in this scope
CUDNN_CONVOLUTION_FWD_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/convolution.hpp:266:21: note: suggested alternative: ‘CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3’
CUDNN_CONVOLUTION_FWD_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/transpose_convolution.hpp: In constructor ‘cv::dnn::cuda4dnn::csl::cudnn::TransposeConvolutionAlgorithm::TransposeConvolutionAlgorithm(const cv::dnn::cuda4dnn::csl::cudnn::Handle&, const cv::dnn::cuda4dnn::csl::cudnn::ConvolutionDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::FilterDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&)’:
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/transpose_convolution.hpp:42:21: error: ‘CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST’ was not declared in this scope
CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/transpose_convolution.hpp:42:21: note: suggested alternative: ‘CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT’
CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/…/cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:7134: recipe for target ‘modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/blank_layer.cpp.o’ failed
make[2]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/blank_layer.cpp.o] Error 1
CMakeFiles/Makefile2:3737: recipe for target ‘modules/dnn/CMakeFiles/opencv_dnn.dir/all’ failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:162: recipe for target ‘all’ failed
make: *** [all] Error 2
Do you wish to remove temporary build files in /tmp/build_opencv ?
(Doing so may make running tests on the build later impossible)
Y/N n
Please answer yes or no.
Do you wish to remove temporary build files in /tmp/build_opencv ?
(Doing so may make running tests on the build later impossible)
Y/N n
This is output of opencv_version --verbose
$ opencv_version 4.4.0-pre opencv_version --verbose
General configuration for OpenCV 4.4.0-pre =====================================
Version control: 8a480ac
Extra modules:
Location (extra): /tmp/build_opencv/opencv_contrib/modules
Version control (extra): 5fae408
Platform:
Timestamp: 2020-07-18T01:16:25Z
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
required: NEON
disabled: VFPV3
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 7.5.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 -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -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 -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 -Winit-self -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 -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 -Winit-self -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 -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 -Winit-self -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 cudart_static -lpthread dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/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 datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cnn_3dobj cvv hdf java js julia matlab ovis sfm ts viz
Applications: apps
Documentation: NO
Non-free algorithms: YES
GUI:
GTK+: YES (ver 3.22.30)
GThread : YES (ver 2.56.4)
GtkGlExt: NO
OpenGL support: NO
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 Jasper (ver 1.900.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: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: YES (/usr/lib/aarch64-linux-gnu/liblapack.so /usr/lib/aarch64-linux-gnu/libcblas.so /usr/lib/aarch64-linux-gnu/libatlas.so)
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: 53 62 72
NVIDIA PTX archs:
cuDNN: YES (ver 8.0)
OpenCL: YES (no extra features)
Include path: /tmp/build_opencv/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
Hallo
I got the following error on my jetson nano
The following packages have unmet dependencies:
libjpeg-dev : Conflicts: libjpeg8-dev but 8c-2ubuntu8 is to be installed
libjpeg62-turbo-dev : Conflicts: libjpeg8-dev but 8c-2ubuntu8 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Thanks for help.
I have used your excellent script in the past successfully, but it seems something changed recently that is giving me the following error:
Reading package lists... Done
E: Failed to fetch http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo/dists/bionic/InRelease 403 Forbidden [IP: 52.218.53.57 80]
E: The repository 'http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic InRelease' is no longer signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Edit to add : Jetpack 4.4
tried ./build_opencv.sh master, same result.
I'm building OpenCV 4.4.0 headlessly on a Jetson Nano with Jetpack 4.4 [L4T 32.4.3]. The build is successful but many tests failed. See attached logs.
build.log
test.log
install.log
test-reports.zip
Apparently the cause is multiple missing input files like ./gpu/opticalflow/frame0.png
. Any tips?
I getting this error while building OpenCV. I appears it's using Python2 to build it. Should that be a problem? Or should it use Python3 if yes how & wha to change?
Bases: cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm
Only the first base class will be used
Note: Class detail_GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions)
Bases: cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder
Only the first base class will be used
[ 98%] Built target gen_opencv_python_source
Scanning dependencies of target opencv_python2
[ 98%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
CMakeFiles/Makefile2:10668: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
This is likely caused by not running sudo apt-get update
before build.
[ 94%] Built target pch_Generate_opencv_cudaoptflow
[ 94%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_tvl1flow.cu.o
[ 94%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_farneback.cu.o
[ 94%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o
Killed
CMake Error at cuda_compile_1_generated_pyrlk.cu.o.Release.cmake:279 (message):
Error generating file
/tmp/build_opencv/opencv/build/modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_pyrlk.cu.o
modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/build.make:70: recipe for target 'modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o' failed
make[2]: *** [modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o] Error 1
CMakeFiles/Makefile2:9900: recipe for target 'modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all' failed
make[1]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
I try to use cuda cv2.cuda_CascadeClassifier, my application based on your docker image here https://hub.docker.com/r/mdegans/tegra-opencv
But I receive error
cv2.error: OpenCV(4.5.1) /tmp/build_opencv/opencv_contrib/modules/cudaobjdetect/src/cascadeclassifier.cpp:155: error: (-217:Gpu API call) NCV Assertion Failed: NcvStat=4, file=/tmp/build_opencv/opencv_contrib/modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu, line=2363 in function 'NCVDebugOutputHandler'
When I check /tmp/ directory inside this docker image, its empty. Cat it be the reason why app is failing?
I know is a stupid question but how can I solve it? (NVIDIA Jetson Nano 2Gb)
Thank you!!
As in the title, are there any modifications for Xavier NX?
Thanks for providing this script, as I will need OpenCV for software I plan to run on my Jetson Nano board.
I have run the build script and it failed right near the end. [please see the output copied from the console]
This was run on a fresh Jetson Nano. The only thing I've done there before running the build script was to update/install a few packages (following this tutorial):
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git cmake
$ sudo apt-get install libatlas-base-dev gfortran
$ sudo apt-get install libhdf5-serial-dev hdf5-tools
$ sudo apt-get install python3-dev
$ cd ~/git
$ git clone https://github.com/mdegans/nano_build_opencv.git
$ cd nano_build_opencv
$ ./build_opencv.sh
The final message in the output (where the fatal error occurs?) appears to be Python2 related. Is it necessary to build OpenCV for Python2 support? I don't plan to use Python2 (all my Python code is Python 3.6+), so maybe I can eliminate the parts that are building for Python2 support and maybe bypass this error as a result?
I apologize I'm unfamiliar with OpenCV builds, compilation error messages, etc. so I'm dependent on others to make sense of this for me. If I can help debug or troubleshoot this issue further from my end then please ask so I can help you help me.
Shouldn't you have compiled it on arm64? I'm assuming you are compiling it on buildx or qemu
That said, I'm appreciative of the script. The jetsonhacks one is getting dated and doesn't work for docker container builds.
I have successfully installed opencv on my jetson nano. But I would like to make a wheel file, and install it on docker, in order not to rebuild it every time. Tell me please is it possible?
Which means imshow can't display a GpuMat without a download. Fix is to track down opengl dev packages in ubuntu's repos and add them to the apt-get install stanza.
This is a known issue when a Tegra device runs out of memory during the latter part of the build. To fix it, configure a swap file before starting the build. I personally recomend using an external ssd rather than swapping of a MicroSD card or EMMC since flash memory wasn't meant for this purpose and it will shorten the lifespan of the disk greatly. Few things wear a ssd, or any sort of flash memory (other than maybe Optane) faster than swap.
Thank you for build script.
It seemed to work fine, but now when I run more heavier python detection code with opencv it shuts it self down. Anyone else with this problem or know a fix?
the code im running worked fine when i had opencv 3.1.
The nano is in 5W mode, and im using a Raspberry Pi camera v2.
I have OpenCV 3.3.1 installed on Nano. I want to rebuild it with Cuda enabled on it. Can we use same script for OpenCV 3.3.1 or any older version than OpenCV 4?
@mdegans I proceed to build opencv to 75% and get this error. Could you give me some advice? Thanks very much.
Cmake 3.13.4
Jetpack 4.5.1
Opencv 4.1.1
cuDNN 8.0.0.180
CUDA 10.2.89
I am trying to build on NX but build fails:
It appears an existing build exists in /tmp/build_opencv
Do you wish to remove temporary build files in /tmp/build_opencv ?
(Doing so may make running tests on the build later impossible)
Y/N Y
Installing build dependencies.
Get:1 file:/var/cuda-repo-10-2-local-10.2.89 InRelease
Ign:1 file:/var/cuda-repo-10-2-local-10.2.89 InRelease
Get:2 file:/var/visionworks-repo InRelease
Ign:2 file:/var/visionworks-repo InRelease
Get:3 file:/var/visionworks-sfm-repo InRelease
Ign:3 file:/var/visionworks-sfm-repo InRelease
Get:4 file:/var/visionworks-tracking-repo InRelease
Ign:4 file:/var/visionworks-tracking-repo InRelease
Get:5 file:/var/cuda-repo-10-2-local-10.2.89 Release [574 B]
Get:6 file:/var/visionworks-repo Release [2,001 B]
Get:7 file:/var/visionworks-sfm-repo Release [2,005 B]
Get:5 file:/var/cuda-repo-10-2-local-10.2.89 Release [574 B]
Get:8 file:/var/visionworks-tracking-repo Release [2,010 B]
Get:6 file:/var/visionworks-repo Release [2,001 B]
Get:7 file:/var/visionworks-sfm-repo Release [2,005 B]
Get:8 file:/var/visionworks-tracking-repo Release [2,010 B]
Hit:9 https://repo.download.nvidia.com/jetson/common r32.5 InRelease
Hit:10 https://repo.download.nvidia.com/jetson/t194 r32.5 InRelease
Hit:11 http://packages.microsoft.com/repos/code stable InRelease
Hit:12 http://packages.ros.org/ros/ubuntu bionic InRelease
Hit:14 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:18 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [74.6 kB]
Get:19 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
Get:21 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 DEP-11 Metadata [290 kB]
Get:22 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe arm64 DEP-11 Metadata [284 kB]
Get:23 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe arm64 DEP-11 Metadata [9,288 B]
Get:24 http://ports.ubuntu.com/ubuntu-ports bionic-security/main arm64 DEP-11 Metadata [42.8 kB]
Get:25 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe arm64 DEP-11 Metadata [55.4 kB]
Fetched 933 kB in 5s (202 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up nvidia-l4t-kernel-dtbs (4.9.201-tegra-32.5.1-20210219084708) ...
Decompile /boot/dtb/kernel_tegra194-p3668-all-p3509-0000.dtb
tegra194-p3668-all-p3509-0000.dtb failed, quit.
dpkg: error processing package nvidia-l4t-kernel-dtbs (--configure):
installed nvidia-l4t-kernel-dtbs package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
nvidia-l4t-kernel-dtbs
E: Sub-process /usr/bin/dpkg returned an error code (1)
Hi, thank you for the shell file
I'm trying to run the shell file inside Dockerfile using l4t-base:r32.2 as base image in a qemu emulator.
While installing, it shows the following output:
Setting up iputils-ping (3:20161105-1ubuntu3) ...
Setting up libcairo2:arm64 (1.15.10-2ubuntu0.1) ...
Setting up console-setup (1.178ubuntu2.9) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Configuring console-setup
-------------------------
1. ARMSCII-8 8. ISIRI-3342 15. ISO-8859-16 22. ISO-8859-8
2. CP1251 9. ISO-8859-1 16. ISO-8859-2 23. ISO-8859-9
3. CP1255 10. ISO-8859-10 17. ISO-8859-3 24. KOI8-R
4. CP1256 11. ISO-8859-11 18. ISO-8859-4 25. KOI8-U
5. GEORGIAN-ACADEMY 12. ISO-8859-13 19. ISO-8859-5 26. TIS-620
6. GEORGIAN-PS 13. ISO-8859-14 20. ISO-8859-6 27. UTF-8
7. IBM1133 14. ISO-8859-15 21. ISO-8859-7 28. VISCII
Encoding to use on the console:
Commands inside Dockerfile
COPY ./build_opencv.sh .
RUN chmod 777 build_opencv.sh
RUN ./build_opencv.sh
CMD [ "bash" ]
After selecting a number, it stucks. Previously, I've been able to install NumPy, PyTorch (GPU support) using the same emulator, so emulator issue seems unlikely.
Please help.
Thanks
Nice job! :) I would like to have it installed to my conda environment. How can I do so?
The conda env path is "/home/nvidia/miniforge-pypy3/envs/envname/bin/"
I installed OpenCV 4.5.2 via this script on a fresh Jetson Nano and checked the installation with the procedure described in this issue. This was working properly, Cuda was enabled and OpenCV version was 4.5.2 both using command opencv_version
and in a Python 3 interpreter.
However, I restarted the Jetson Nano and now in a Python 3 interpreter I got version 4.1.1. If I open an interpreter in sudo mode it still shows version 4.5.2.
Do you know the cause of this issue? However, solving the issue does not seem hard, I guess that copying the system Python cv2 shared library to the local Python dist-package folder should do the trick.
Hi Michael,
First of all, thanks for sharing your knowledge and this script.
I have been using OpenCV with CUDA in a Bare metal server and now I'm trying to use it in a Jetson Nano.
I have modified your script to support NVCUVID by adding the flag:
-D WITH_NVCUVID=ON
However, when I execute the script, it doesn't show that is building using it:
NVIDIA CUDA: YES(ver 10.2 CUFFT CUBLAS FAST_MATH)
Do you have any insights on why this may be happening?
Regards
So I naively thought that this script will work on my Jetson Xavier NX , guess what, it's killed the boot. Why does it need to change my bootloader and my firmware to install openCV ? How can I fix that ? formating the SD card didn't change anything ...
here is the install log https://pastebin.com/EywverjH
Hi, thank you for the shell file
I'm trying to run the shell file inside Dockerfile using l4t-base:r32.2 as base image in a qemu emulator.
While installing, it shows the following output:
-- Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH - Failed
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- Performing Test CXX_HAS_MFPU_NEON
-- Performing Test CXX_HAS_MFPU_NEON - Failed
-- Performing Test C_HAS_MFPU_NEON
-- Performing Test C_HAS_MFPU_NEON - Failed
-- Looking for dlerror in dl
-- Looking for dlerror in dl - found
-- Performing Test HAVE_C_WNO_UNDEF
-- Performing Test HAVE_C_WNO_UNDEF - Success
-- ADE: Download: v0.1.1f.zip
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
-- OpenCV Python: during development append to PYTHONPATH: /tmp/build_opencv/opencv/build/python_loader
-- Performing Test HAVE_CXX_WNO_STRICT_ALIASING
-- Performing Test HAVE_CXX_WNO_STRICT_ALIASING - Success
-- Checking for modules 'libavcodec;libavformat;libavutil;libswscale'
-- Found libavcodec, version 57.107.100
-- Found libavformat, version 57.83.100
-- Found libavutil, version 55.78.100
-- Found libswscale, version 4.8.100
-- Checking for module 'libavresample'
-- Found libavresample, version 3.7.0
-- Checking for module 'gstreamer-base-1.0'
-- Found gstreamer-base-1.0, version 1.14.5
-- Checking for module 'gstreamer-app-1.0'
It gets stuck at checking 'gstreamer-app-1.0' module (more than 1 hour).
Please help.
Thanks
Hello, i built opencv using your instruction and when using rtabmap the following errors appear. Features2d.cpp:529::create() BRIEF and FREAK features cannot be used because OpenCV was not built with xfeatures2d module. GFTT/ORB is used instead. Features2d.cpp:1084::parseParameters() GPU version of ORB not available (OpenCV cudafeatures2d module)! Using CPU version instead... please help me how to install or fix this module
I am running an Xavier NX with Jetpack 4.2. After an OTA update cv2 won't import (before or after building with this script). To on my system I can build OpenCV running sudo ./build_opencv.sh master
and trying to import cv2 in python 3.6.9
My OpenCV build information is:
General configuration for OpenCV 4.4.0-dev =====================================
Version control: e65e23b
Extra modules:
Location (extra): /tmp/build_opencv/opencv_contrib/modules
Version control (extra): 4.4.0
Platform:
Timestamp: 2020-07-20T13:29:52Z
Host: Linux 4.9.140-tegra aarch64
CMake: 3.17.3
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline: NEON FP16
required: NEON
disabled: VFPV3
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 7.5.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 -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -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 -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 -Winit-self -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 -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 -Winit-self -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 -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 -Winit-self -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 cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/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 datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cnn_3dobj cvv hdf java js julia matlab ovis sfm ts viz
Applications: apps
Documentation: NO
Non-free algorithms: YES
GUI:
GTK+: YES (ver 3.22.30)
GThread : YES (ver 2.56.4)
GtkGlExt: NO
OpenGL support: NO
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 Jasper (ver 1.900.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: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: YES (/usr/lib/aarch64-linux-gnu/liblapack.so /usr/lib/aarch64-linux-gnu/libcblas.so /usr/lib/aarch64-linux-gnu/libatlas.so)
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: 53 62 72
NVIDIA PTX archs:
cuDNN: YES (ver 8.0)
OpenCL: YES (no extra features)
Include path: /tmp/build_opencv/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
I ran the build script and opencv4 was installed only for Python 2 and not 3 - with python 3 defaulting to '3.3.1'. Any clues what might be the case?
Getting version '4.0.0' of OpenCV
Cloning into 'opencv'...
remote: Enumerating objects: 6852, done.
remote: Counting objects: 100% (6852/6852), done.
remote: Compressing objects: 100% (5928/5928), done.
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
I can programming opencv in c++?
circular dependency issue -- will need to remove libgstreamer-plugins-bad1.0-dev
The following information may help resolve the situation:
The following packages have unmet dependencies:
libgstreamer-plugins-bad1.0-dev : Depends: libopencv-dev (>= 2.3.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Thank you for the script. I have a fresh Jetson Nano image. Booted, went through setup, ran your script. Any ideas? TIA.
Scanning dependencies of target gen_opencv_python_source
[ 98%] Generate files for Python bindings and documentation
Note: Class Feature2D has more than 1 base class (not supported by Python C extensions)
Bases: cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm
Only the first base class will be used
Note: Class detail_GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions)
Bases: cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder
Only the first base class will be used
[ 98%] Built target gen_opencv_python_source
Scanning dependencies of target opencv_python2
[ 98%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-7/README.Bugs for instructions.
modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o' failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
CMakeFiles/Makefile2:10533: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
When i run the script, show the follow errors:
E: Package 'gfortran' has no installation candidate
E: Package 'libgstreamer-plugins-good1.0-dev' has no installation candidate
E: Package 'libgtk-3-dev' has no installation candidate
E: Package 'liblapack-dev' has no installation candidate
E: Unable to locate package liblapacke-dev
E: Package 'libtiff-dev' has no installation candidate
Scanning dependencies of target opencv_cudaoptflow_pch_dephelp
[ 94%] Building CXX object modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow_pch_dephelp.dir/opencv_cudaoptflow_pch_dephelp.cxx.o
In file included from /tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy.hpp:50:0,
from /tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/private.hpp:57,
from /tmp/build_opencv/opencv_contrib/modules/cudaoptflow/src/precomp.hpp:59,
from /tmp/build_opencv/opencv/build/modules/cudaoptflow/opencv_cudaoptflow_pch_dephelp.cxx:1:
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp: In member function ‘NCVStatus HaarFeature64::setRect(Ncv32u, Ncv32u, Ncv32u, Ncv32u, Ncv32u, Ncv32u)’:
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:87:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->x = (Ncv8u)rectX;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:88:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->y = (Ncv8u)rectY;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:89:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->width = (Ncv8u)rectWidth;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:90:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->height = (Ncv8u)rectHeight;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp: In member function ‘void HaarFeature64::getRect(Ncv32u*, Ncv32u*, Ncv32u*, Ncv32u*)’:
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:102:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
NcvRect8u tmpRect = *(NcvRect8u*)(&this->_ui2.x);
^
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:102:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[ 94%] Linking CXX static library ../../lib/libopencv_cudaoptflow_pch_dephelp.a
[ 94%] Built target opencv_cudaoptflow_pch_dephelp
Scanning dependencies of target pch_Generate_opencv_cudaoptflow
[ 94%] Generating precomp.hpp
[ 94%] Generating precomp.hpp.gch/opencv_cudaoptflow_Release.gch
In file included from /tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy.hpp:50:0,
from /tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/private.hpp:57,
from /tmp/build_opencv/opencv/build/modules/cudaoptflow/precomp.hpp:59:
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp: In member function ‘NCVStatus HaarFeature64::setRect(Ncv32u, Ncv32u, Ncv32u, Ncv32u, Ncv32u, Ncv32u)’:
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:87:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->x = (Ncv8u)rectX;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:88:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->y = (Ncv8u)rectY;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:89:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->width = (Ncv8u)rectWidth;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:90:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->height = (Ncv8u)rectHeight;
^~
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp: In member function ‘void HaarFeature64::getRect(Ncv32u*, Ncv32u*, Ncv32u*, Ncv32u*)’:
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:102:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
NcvRect8u tmpRect = *(NcvRect8u*)(&this->_ui2.x);
^
/tmp/build_opencv/opencv_contrib/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:102:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[ 94%] Built target pch_Generate_opencv_cudaoptflow
[ 94%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_tvl1flow.cu.o
[ 94%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_farneback.cu.o
[ 94%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o
Killed
CMake Error at cuda_compile_1_generated_pyrlk.cu.o.Release.cmake:279 (message):
Error generating file
/tmp/build_opencv/opencv/build/modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_pyrlk.cu.o
modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/build.make:70: recipe for target 'modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o' failed
make[2]: *** [modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o] Error 1
CMakeFiles/Makefile2:9900: recipe for target 'modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all' failed
make[1]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Does the script work for version 4.5.1 of OpenCV?
Also, will it work with JetPack 4.5?
Thanks,
Marcelo
Thanks for the script!
Just some warnings when I try to run the script, but won't affect the script running.
build_opencv.sh: 110: build_opencv.sh: [[: not found
build_opencv.sh: 114: build_opencv.sh: [[: not found
build_opencv.sh: 33: build_opencv.sh: [[: not found
i have:
jetson nano Nvidia (arm64 architecture) with ububntu 18
i tried to run this script ( i need CUDA in opencv for run codes on GPU)
i made a little change in the script -rename the name "build_opencv" to "buildopencv" ( it is not the issue )
i run the script ./build_opencv.sh 4.3.0
and i got failed in the building ...
i attached the cmake log output and cmake error log:
CMakeError.log
CMakeOutput.log
if someone can help me ,please .. :)
[ 50%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/blank_layer.cpp.o
In file included from /tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/csl/cudnn.hpp:8:0,
from /tmp/build_opencv/opencv/modules/dnn/src/layers/../op_cuda.hpp:11,
from /tmp/build_opencv/opencv/modules/dnn/src/layers/blank_layer.cpp:43:
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/primitives/../csl/cudnn/convolution.hpp: In constructor ‘cv::dnn::cuda4dnn::csl::cudnn::ConvolutionAlgorithm::ConvolutionAlgorithm(const cv::dnn::cuda4dnn::csl::cudnn::Handle&, const cv::dnn::cuda4dnn::csl::cudnn::ConvolutionDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::FilterDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&)’:
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/primitives/../csl/cudnn/convolution.hpp:266:21: error: ‘CUDNN_CONVOLUTION_FWD_PREFER_FASTEST’ was not declared in this scope
CUDNN_CONVOLUTION_FWD_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/primitives/../csl/cudnn/convolution.hpp:266:21: note: suggested alternative: ‘CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3’
CUDNN_CONVOLUTION_FWD_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/primitives/../csl/cudnn/transpose_convolution.hpp: In constructor ‘cv::dnn::cuda4dnn::csl::cudnn::TransposeConvolutionAlgorithm::TransposeConvolutionAlgorithm(const cv::dnn::cuda4dnn::csl::cudnn::Handle&, const cv::dnn::cuda4dnn::csl::cudnn::ConvolutionDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::FilterDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&, const cv::dnn::cuda4dnn::csl::cudnn::TensorDescriptor&)’:
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/primitives/../csl/cudnn/transpose_convolution.hpp:42:21: error: ‘CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST’ was not declared in this scope
CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/primitives/../csl/cudnn/transpose_convolution.hpp:42:21: note: suggested alternative: ‘CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT’
CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST,
^
/tmp/build_opencv/opencv/modules/dnn/src/layers/../cuda4dnn/csl/cudnn/cudnn.hpp:23:53: note: in definition of macro ‘CUDA4DNN_CHECK_CUDNN’
::cv::dnn::cuda4dnn::csl::cudnn::detail::check((call), CV_Func, FILE, LINE)
^~~~
modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:721: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/blank_layer.cpp.o' failed
make[2]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/blank_layer.cpp.o] Error 1
CMakeFiles/Makefile2:3798: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
How can i install openCV with cuda support on Jetson nano with 16 gb sd card inside? If i try use script not enough memory error appear.
I updated the line to
readonly DEFAULT_VERSION=4.1.1
Tried to run the script twice on Jetson Nano, got same error.
...
[ 25%] Built target opencv_cudev
Scanning dependencies of target opencv_core_pch_dephelp
[ 25%] Building CXX object modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o
In file included from /tmp/build_opencv/opencv/modules/core/src/precomp.hpp:55:0,
from /tmp/build_opencv/opencv/build/modules/core/opencv_core_pch_dephelp.cxx:1:
/tmp/build_opencv/opencv/modules/core/include/opencv2/core/private.hpp:66:12: fatal error: Eigen/Core: No such file or directory
# include <Eigen/Core>
^~~~~~~~~~~~
compilation terminated.
modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/build.make:62: recipe for target 'modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o] Error 1
CMakeFiles/Makefile2:2699: recipe for target 'modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Will run using original 4.1.0 again and report back.
Can confirm the issue only happens on 4.1.1. The original 4.1.0 works perfect! Thanks!
Caused by a missing cd
Hello, thank you for your build script for the nano. I ran the script overnight and I think it finished building, however is there a way to check if it built successfully? And is there any way you know how to get this built opencv to work with a virtual environment on the nano, i ran the script from inside the virtual environment but it still doesn't find module cv2. Help would be super appreciated thank you!
currently in my /tmp/ folder i see a folder build-opencv, however I don't know if it is supposed to be like that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.