CMake Cross compile Arm64 error “unrecognised command line option ‘-msse’”

Viewed 22

I am trying to cross-compile openCV for an Arm64 linux platform 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. 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 ..

I am building on linux ubuntu 18.4. How to do I tell CMake that the platform is Arm64? Thanks

1 Answers

I resolved the issue, the missing flag I was looking for was

-D CMAKE_TOOLCHAIN_FILE=../platforms/linux/aarch64-gnu.toolchain.cmake
Related