Skip to content

[Build] Cross build failure for CPU architecture ARM Cortex A53 with Flags "-march=armv8-a -mtune=cortex-a53" due to Eigen3 library. #22463

Description

Describe the issue

I am trying to build onnxruntime for a Raspberry Pi 3 with the CPU core architecture Cortex-A53 but the build fails and the issue are pointing to Eigen3 Library.

I am cross building it on a WSL Ubuntu 22.04 setup on a Windows machine. But I also tried to build it natively on the Raspberry Pi with similar failures.

Urgency

The build failure is blocking a project from moving forward.

Target platform

Linux aarch64

Build script

cmake .. -Donnxruntime_ENABLE_CPUINFO=OFF -Donnxruntime_GCC_STATIC_CPP_RUNTIME=ON -DCMAKE_C_FLAGS="-march=armv8-a -mtune=cortex-a53 -Wno-error" -DCMAKE_CXX_FLAGS="-march=armv8-a -mtune=cortex-a53 -Wno-error" Donnxruntime_DEV_MODE=OFF -DCMAKE_TOOLCHAIN_FILE=arm64.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -Donnxruntime_BUILD_UNIT_TESTS=OFF -Donnxruntime_BUILD_SHARED_LIB=ON -Donnxruntime_USE_CUDA=OFF -Donnxruntime_USE_DML=OFF


Custom Toolchain File:

Specify the cross compiler

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

Specify the cross compiler

set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)

Search for programs in the build host directories

set(CMAKE_FIND_PROGRAMS)

Search for headers and libraries in the target environment

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Error / output

/home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:855:85: error: type/value mismatch at argument 1 in template parameter list for ‘template const Eigen::CwiseBinaryOp<Eigen::internal::scalar_max_op<typename Eigen::internal::traits::Scalar, typename Eigen::internal::traits::Scalar>, const Derived, const OtherDerived> Eigen::ArrayBase::max(const Eigen::ArrayBase&) const [with OtherDerived = OtherDerived; Derived = Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<long unsigned int, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >]’
855 | per_iter_bh.EigenInput0().array().template maxEigen::PropagateNaN(per_iter_bh.ScalarInput1());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:855:85: note: expected a type, got ‘Eigen::PropagateNaN’
/home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:859:85: error: no matching function for call to ‘Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<long unsigned int, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::maxEigen::PropagateNaN(Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<long unsigned int, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >)’
859 | per_iter_bh.EigenInput0().array().template maxEigen::PropagateNaN(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
860 | per_iter_bh.EigenInput1().array());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/eigen3/Eigen/Core:19,
from /home/user/onnxruntime/onnxruntime/core/util/math_cpuonly.h:68,
from /home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.h:10,
from /home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:4:
/usr/include/eigen3/Eigen/src/Core/../plugins/ArrayCwiseBinaryOps.h:59:28: note: candidate: ‘template const Eigen::CwiseBinaryOp<Eigen::internal::scalar_max_op<typename Eigen::internal::traits::Scalar, typename Eigen::internal::traits::Scalar>, const Derived, const OtherDerived> Eigen::ArrayBase::max(const Eigen::ArrayBase&) const [with OtherDerived = OtherDerived; Derived = Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<long unsigned int, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >]’
59 | EIGEN_MAKE_CWISE_BINARY_OP(max,max)
| ^~~
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:1339:4: note: in definition of macro ‘EIGEN_MAKE_CWISE_BINARY_OP’
1339 | (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const
| ^~~~~~
/usr/include/eigen3/Eigen/src/Core/../plugins/ArrayCwiseBinaryOps.h:59:28: note: template argument deduction/substitution failed:
59 | EIGEN_MAKE_CWISE_BINARY_OP(max,max)
| ^~~
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:1339:4: note: in definition of macro ‘EIGEN_MAKE_CWISE_BINARY_OP’
1339 | (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const
| ^~~~~~
/home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:859:85: error: type/value mismatch at argument 1 in template parameter list for ‘template const Eigen::CwiseBinaryOp<Eigen::internal::scalar_max_op<typename Eigen::internal::traits::Scalar, typename Eigen::internal::traits::Scalar>, const Derived, const OtherDerived> Eigen::ArrayBase::max(const Eigen::ArrayBase&) const [with OtherDerived = OtherDerived; Derived = Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<long unsigned int, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >]’
859 | per_iter_bh.EigenInput0().array().template maxEigen::PropagateNaN(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
860 | per_iter_bh.EigenInput1().array());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:859:85: note: expected a type, got ‘Eigen::PropagateNaN’

Visual Studio Version

No response

GCC / Compiler Version

aarch64-linux-gnu v11.4.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildbuild issues; typically submitted using template

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions