Did anybody manage to cross compile it? I'm trying to cross compile it in a docker container I use to develop application for a raspberry pi4. So far I did not have any issues (opencv, boost, libusb, any some more), but I just can't get depthai-core to compile.
This is how I tried to build it:
cmake -S. \
-Bbuild \
-D'BUILD_SHARED_LIBS=ON' \
-DCMAKE_TOOLCHAIN_FILE=/home/dev/toolchain_settings/docker_toolchain.cmake
I did:
git submodule update --init --recursive
OpenCV 4.7.0 for examples worked without any issue:
cmake \
-DBUILD_opencv_gapi=OFF \
-DWITH_LAPACK=OFF \
-DWITH_ITT=OFF \
-DWITH_GTK=OFF \
-DWITH_GSTREAMER=OFF \
-DWITH_JASPER=OFF \
-DWITH_IPP=OFF \
-DWITH_V4L=OFF \
-DWITH_WEBP=OFF \
-DWITH_VTK=OFF \
-DWITH_PROTOBUF=OFF \
-DWITH_CUDA=OFF \
-DWITH_1394=OFF \
-DENABLE_PRECOMPILED_HEADER=NO \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=NO \
-DCMAKE_TOOLCHAIN_FILE=/home/dev/toolchain_settings/docker_toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local \
..
docker_toolchain.cmake looks as follow:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSROOT /home/dev/x-tools/aarch64-rpi4-linux-gnu/aarch64-rpi4-linux-gnu/sysroot)
set(ARM_TOOL_SET /home/dev/x-tools/aarch64-rpi4-linux-gnu/bin/)
set(CMAKE_C_COMPILER ${ARM_TOOL_SET}/aarch64-rpi4-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${ARM_TOOL_SET}/aarch64-rpi4-linux-gnu-g++)
\# Optionally reduce compiler sanity check when cross-compiling.
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(CMAKE_C_FLAGS "-pipe -mlittle-endian -O3 -Wall -Wextra -D_REENTRANT -fPIC -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_GLIBCXX_USE_NANOSLEEP -DINTERNAL_LINKING_RAM" CACHE INTERNAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE INTERNAL "")
set(CMAKE_C_FLAGS_DEBUG "-Os -g" CACHE INTERNAL "")
set(CMAKE_C_FLAGS_RELEASE "-Os -DNDEBUG" CACHE INTERNAL "")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE INTERNAL "")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Any suggestions?