Cannot build opencv 4.8.0 with nvidia docker

HI,

I don’t know if this is the right place.
I have been trying to build opencv 4.8 on nvcr.io/nvidia/jetpack-linux-aarch64-crosscompile-x86:5.1.2 based image.
When i use the attached cmake file
aarch64-toolchain-jetson.cmake.txt (2.1 KB)
with the below cmake command :
cmake …/…/… -DBUILD_LIST=core,imagecodecs,imgproc,videoio,calib3d,highgui -DBUILD_opencv_apps=OFF \

-DBUILD_SHARED_LIBS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_TESTS=OFF
-DBUILD_DOCS=OFF
-DENABLE_NEON=OFF
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=/nvidia-orin/build_tools/cmake/aarch64-toolchain-jetson.cmake
-DCMAKE_INSTALL_PREFIX=“/usr/local/opencv”
-DFFMPEG_DIR=“/usr/local/ffmpeg” -DWITH_FFMPEG=ON -DFFMPEG_INCLUDE_DIRS=“/usr/local/ffmpeg/include” -DOPENCV_FFMPEG_SKIP_BUILD_CHECK=ON -DWITH_CAROTENE=OFF -DCUDA_ROOT=“/usr/local/cuda/targets/aarch64-linux” -DWITH_CUDA=ON -D OPENCV_DNN_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib-4.8.0/modules/ --fresh
i get the below error:
CMake Error at CMakeLists.txt:160 (message):
CMake fails to determine the bitness of the target platform.

Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.

How can i fix it?
It also happens with opencv 4.2.0

Thanks,
Oren

Moved to Jetson AGX Orin forum

Hi,

Could you remove the below line and try it again?

-DCMAKE_TOOLCHAIN_FILE=/nvidia-orin/build_tools/cmake/aarch64-toolchain-jetson.cmake

Thanks.

Hi,

It works, but it will not compile to aarch64.
I am not building on the board, but i want to cross-compile to aarach16, that’s why i am using the docker and -DCMAKE_TOOLCHAIN_FILE

Thanks,
Oren

Hi,

Have you installed the cross-compile toolchain? (ex. g+±aarch64-linux-gnu)
Thanks.

Its apart of the docker image.
It’s already in the docker image at /usr/bin
The toolchain is at /usr/aarch64-linux-gnu

The toolchain does not contain lib64:
ls /usr/aarch64-linux-gnu/
bin include lib

But event when i copy lib to lib 64 it didnt help

Hi,

Do you use our cross-compile container?
If not, could you give it a try?

Thanks.

HI, yes.
I am using nvcr.io/nvidia/jetpack-linux-aarch64-crosscompile-x86:5.1.2

Thanks,
Oren

Hi,

We need to check it further.
Will share more information with you later.

Thanks.

Hi,

Thanks for your patience.

We can build OpenCV 4.8 within the cross-compile container.
Please give it a try:

Host install_opencv4.8.0_Jetson.sh (2.5 KB)

$ sudo docker run -it --privileged --net=host -v /dev/bus/usb:/dev/bus/usb -v ${WORKSPACE}:/workspace nvcr.io/nvidia/jetpack-linux-aarch64-crosscompile-x86:5.1.2
$ chmod +x install_opencv4.8.0_Jetson.sh
$ ./install_opencv4.8.0_Jetson.sh

Copy workspace/opencv-4.8.0/release to device

Device

$ cd release
$ sudo make install && sudo ldconfig
$  opencv_version -v

General configuration for OpenCV 4.8.0 =====================================
  Version control:               58f22c2-dirty

  Extra modules:
    Location (extra):            /l4t/workspace/opencv_contrib-4.8.0/modules
    Version control (extra):     58f22c2-dirty

  Platform:
    Timestamp:                   2023-10-23T06:42:37Z
    Host:                        Linux 5.4.0-150-generic x86_64
    Target:                      Linux 1 aarch64
...

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.