Cross compile open CV for Jetson TX2

I am trying to cross-compile openCV for my jetson TX2 and am getting the following errors

aarch64-linux-gnu-gcc: error: unrecognised command line option ‘-msse’; did you mean ‘-fdse’?

aarch64-linux-gnu-gcc: error: unrecognised command line option ‘-msse2’

aarch64-linux-gnu-gcc: error: unrecognised command line option ‘-msse3’

I understand that the -msse flags are not compatible with arm64, yet when I generate my makefile from CMake, these flags are include.
I am building on ubuntu 18.4 and my cmake command is
cmake -D CMAKE_BUILD_TYPE=RELEASE
-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-10/bin/nvcc
-DCUDA_HOST_COMPILER=/opt/l4t-gcc-toolchain-64-bit-32-7.1/bin/aarch64-linux-gnu-gcc
-DCUDA_INCLUDE_DIRS=/usr/local/cuda-10/targets/aarch64-linux/include
-DCUDA_CUDART_LIBRARY=/usr/local/cuda-10/targets/aarch64-linux/lib/libcudart.so
-D CMAKE_INSTALL_PREFIX=/usr/local
-D OPENCV_GENERATE_PKGCONFIG=ON
-D BUILD_EXAMPLES=OFF
-D WITH_CUDA=ON
-D CUDA_ARCH_BIN=“6.2”
-D INSTALL_PYTHON_EXAMPLES=OFF
-D INSTALL_C_EXAMPLES=OFF
-D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib-4.4.0/modules/
-D ENABLE_CXX11=ON …
Am I missing something to specify that I am building for Arm64?
Thanks

I resolved the problem by adding the flag
-D CMAKE_TOOLCHAIN_FILE=../platforms/linux/aarch64-gnu.toolchain.cmake

1 Like

Great! Thanks for sharing the solution.