Minor suggestions: Make -j4 failed a lot in my tests. I tried in my own script. It uses too much memory, especially towards the end when it links everything together.
-D CUDA_ON enables (partially broken) CUDA support. I believe it may have to be explicitly specified to be enabled since its a non free component. Can you post the results of a print(cv2.getBuildInformation) pls?
Lastly, There are a few build scripts you can modify or contribute to if you prefer not to write from scratch:
Thank you so much for your kind reply and informations.
According to your process, I recommend you to build a swap file first to avoid memory leak.
For me, there is no problem to build and compile OpenCV on the Jetson Nano.
Just a good fan to cool the CPU/GPU, and that’s it. ;-)
A swap file will prevent a crash caused by running out of memory, but you may lose the speed you gain
from multiple jobs becausee it’s swapping from a Micro SD card. Swapping from a Micro SD card regularly will also greatly reduced it’s lifespan.
When you re-run the cmake install, are the hashes of the the received file the same across errors? I am trying to determine whether the error is random or not. This will help determine the cause. Please try to install cmake again and post the error.
Get:1 Index of /ubuntu-ports bionic-updates/main arm64 cmake-data all 3.10.2-1ubuntu2.18.04.1 [1,332 kB]
Err:1 Index of /ubuntu-ports bionic-updates/main arm64 cmake-data all 3.10.2-1ubuntu2.18.04.1
Hash Sum mismatch
Hashes of expected file:
That’s strange. Can you post the contents of your /etc/apt/sources.list? I will try to install the package in question later and see if I get the same error.
So I installed cmake on my xavier and on a nano chroot and it works fine. I will try it on an actual nano on monday. I would check /etc/apt/sources.list, your network configuration, and if everyting seems fine after that, backup what you need and reflash. If it keeps happening, you might consider trying from another network.
from the nano chroot:
root@hostname:/# apt install -y cmake
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
cmake-data libcurl4 libjsoncpp1 librhash0 libuv1
Suggested packages:
cmake-doc ninja-build
The following NEW packages will be installed:
cmake cmake-data libcurl4 libjsoncpp1 librhash0 libuv1
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,678 kB of archives.
After this operation, 24.3 MB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 cmake-data all 3.10.2-1ubuntu2.18.04.1 [1,332 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 libcurl4 arm64 7.58.0-2ubuntu3.8 [180 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 libjsoncpp1 arm64 1.7.4-3 [69.2 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 librhash0 arm64 1.3.6-2 [71.8 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 libuv1 arm64 1.18.0-3 [53.7 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 cmake arm64 3.10.2-1ubuntu2.18.04.1 [2,971 kB]
Fetched 4,678 kB in 2s (2,988 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (19: No such device)
Selecting previously unselected package cmake-data.
(Reading database ... 119123 files and directories currently installed.)
Preparing to unpack .../0-cmake-data_3.10.2-1ubuntu2.18.04.1_all.deb ...
Unpacking cmake-data (3.10.2-1ubuntu2.18.04.1) ...
Selecting previously unselected package libcurl4:arm64.
Preparing to unpack .../1-libcurl4_7.58.0-2ubuntu3.8_arm64.deb ...
Unpacking libcurl4:arm64 (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package libjsoncpp1:arm64.
Preparing to unpack .../2-libjsoncpp1_1.7.4-3_arm64.deb ...
Unpacking libjsoncpp1:arm64 (1.7.4-3) ...
Selecting previously unselected package librhash0:arm64.
Preparing to unpack .../3-librhash0_1.3.6-2_arm64.deb ...
Unpacking librhash0:arm64 (1.3.6-2) ...
Selecting previously unselected package libuv1:arm64.
Preparing to unpack .../4-libuv1_1.18.0-3_arm64.deb ...
Unpacking libuv1:arm64 (1.18.0-3) ...
Selecting previously unselected package cmake.
Preparing to unpack .../5-cmake_3.10.2-1ubuntu2.18.04.1_arm64.deb ...
Unpacking cmake (3.10.2-1ubuntu2.18.04.1) ...
Setting up libuv1:arm64 (1.18.0-3) ...
Setting up libcurl4:arm64 (7.58.0-2ubuntu3.8) ...
Setting up cmake-data (3.10.2-1ubuntu2.18.04.1) ...
Setting up librhash0:arm64 (1.3.6-2) ...
Setting up libjsoncpp1:arm64 (1.7.4-3) ...
Setting up cmake (3.10.2-1ubuntu2.18.04.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Glad that fixed it. Some ISPs set up caching, and sometimes the cache can be out of date. You may wish to set up your gateway and/or nanos themselves to use google/cloudflare dns instead of that of your ISP. That may help prevent this from happening again and is often just a good idea.
Running out of memory at the end of the build is a known issue. Adding more swap temporarily will help, or…
My usual fix is to turn off the GUI temporarily (systemctl isolate multi-user.target). You must have an HDMI monitor connected, last I checked, or ssh set up. Display Port will result in a black screen unless this has been fixed since I last tried.
Then re-run the build. It should be faster with more free memory anyway.
Hi, thanks very much for the instructions. However I ran into an issue where the OpenCV4.1 only affected Python2.7 and Python3.6 remained unaffected (still has opencv3). Can someone help me out on this? Thank you very much!