- Build on a Linux system (assumed to be
amd64
/x86_64
) - Setup a chroot (to build on older distro for glibc compatibility)
# Use different package manager if not debian based system sudo apt install schroot debootstrap # Make chroot sudo debootstrap --variant=buildd --arch=amd64 focal /srv/chroot/focal-amd64 http://archive.ubuntu.com/ubuntu/
- Write chroot config file
/etc/schroot/chroot.d/focal-amd64.conf
[focal-amd64] description=Ubuntu 20.04 (amd64) type=directory directory=/srv/chroot/focal-amd64 users=[YOUR_USERNAME] root-groups=root profile=desktop personality=linux
- On more recent Ubuntu / Debian systems,
yescrypt
is used, but this is not supported in older systems (focal included). Thus change/etc/pam.d/common-password
by modifyingyescrypt
to besha512
. Failing to do so will preventsudo
from working in the chroot environment. - Enter chroot with
sudo schroot -c focal-amd64
and runsed -i 's/focal main/focal main universe multiverse/g' /etc/apt/sources.list apt update apt install sudo locales git python3 zip exit
- Enter the chroot without sudo
schroot -c focal-amd64
- Run the build
cd linux-amd64-pc ./buildopencv.sh | tee build.log cd build zip -0 linux-amd64-pc.zip OpenCV-*.deb OpenCV-*.tar.gz OpenCV-*.sh
- Upload the sh file
- Build on a Linux system (assumed to be
amd64
/x86_64
) - Setup a chroot (to build on older distro for glibc compatibility)
# Use different package manager if not debian based system sudo apt install schroot debootstrap qemu-user-static # Make chroot sudo debootstrap --variant=buildd --arch=arm64 focal /srv/chroot/focal-arm64 http://ports.ubuntu.com/ubuntu-ports
- Write chroot config file
/etc/schroot/chroot.d/focal-arm64.conf
[focal-arm64] description=Ubuntu 20.04 (arm64) type=directory directory=/srv/chroot/focal-arm64 users=[YOUR_USERNAME] root-groups=root profile=desktop personality=linux
- On more recent Ubuntu / Debian systems,
yescrypt
is used, but this is not supported in older systems (focal included). Thus change/etc/pam.d/common-password
by modifyingyescrypt
to besha512
. Failing to do so will preventsudo
from working in the chroot environment. - Enter chroot with
sudo schroot -c focal-arm64
and runsed -i 's/focal main/focal main universe multiverse/g' /etc/apt/sources.list apt update apt install sudo locales git python3 zip exit
- Enter the chroot without sudo
schroot -c focal-arm64
- Run the build
cd linux-arm64-pc ./buildopencv.sh | tee build.log
- Upload the sh file
Note: you can build natively on a Jetson Nano. However, you may need a swapfile on the SD card. Also, if building on the jetson nano, change BUILD_THREADS to 1 in the build script.
- Build on a Linux system (assumed to be
amd64
/x86_64
) - Setup a chroot using an Ubuntu Focal Jetson nano image link
# Use different package manager if not debian based system sudo apt install schroot qemu-user-static # Mount image sudo losetup -f -P --show ./jetson-image.img sudo mkdir /srv/chroot/jetson-image sudo mount /dev/loop# /srv/chroot/jetson-image
- Write chroot config file
/etc/schroot/chroot.d/focal-arm64.conf
[jetson-image] description=Jetson OS Image type=directory directory=/srv/chroot/jetson-image users=[YOUR_USERNAME] root-groups=root profile=desktop personality=linux
- On more recent Ubuntu / Debian systems,
yescrypt
is used, but this is not supported in older systems (focal included). Thus change/etc/pam.d/common-password
by modifyingyescrypt
to besha512
. Failing to do so will preventsudo
from working in the chroot environment. - Enter chroot with
sudo schroot -c jetson-image
and runsed -i 's/focal main/focal main universe multiverse/g' /etc/apt/sources.list apt update apt install sudo locales git python3 zip exit
- Enter the chroot without sudo
schroot -c jetson-image
- Run the build
cd linux-arm64-jetsonnano ./buildopencv.sh | tee build.log
- Upload the sh file
- Install the following
- CMake: Make sure cmake is in your
PATH
- Build Tools for Visual Studio
- GStreamer: Use the "MSVC development installer" and perform a "complete install"
- OpenJDK 11: Make sure
JAVA_HOME
is set to the directory java is installed in (not the bin, the root directory). Alternatively, you can make sure the desired java is in yourPATH
. - Apache ANT: Make sure
ant
is in your path - Python 3.8: Make sure the desired python is the first item in your path and is named
python3
notpython
(just rename the exe file). - NumPy (
python3 -m pip install numpy
)
- CMake: Make sure cmake is in your
- Note that the build script requires Windows 10 17063 or later which includes curl and bsdtar
- Run the build
cd windows-arm64-pc .\buildopencv.cmd cd build
- Upload the installer