-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Build] Cross build failure for CPU architecture ARM Cortex A53 with Flags "-march=armv8-a -mtune=cortex-a53" due to Eigen3 library. #22463
Comments
I have the same error as well. But I'm building it directly on the ARM Cortex-A9 device (Linux pynq 5.15.19-xilinx-v2022.1 #1 SMP PREEMPT Mon Apr 11 17:52:14 UTC 2022 armv7l armv7l armv7l GNU/Linux ) using cmake version 3.31.20241016-gee2eadb. Here is my build command: |
I'm having the same issue building for Linux x86_64 on an x86_64 computer:
|
What version of Eigen are you using? I was able to bypass this issue by pointing Onnxruntime to use a local copy of Eigen which is newer than my system Eigen3. The 3.4 branch doesn't have it, you need to use Eigen from master. From your original log: Seems to me you installed Eigen from your system package manager, which is the same as mine (and those are generally oudated). However, pointing to your own custom path of Eigen with the build options is a bit tricky: #22515 - it will default to your system's Eigen even if you supply
|
It seems I was able to bypass this issue by removing my system Eigen3. I'm not 100% sure as the build is still in progress (91%).
|
Makes sense to me - if you delete your outdated system Eigen3, onnxruntime will download a newer version which supports this template |
I encountered this issues too. It turns out the cmake scripts are a bit flawed. If egien is found on the system it will always use that. It will never import the cmake file and thus it will not honour the --use_preinstalled_eigen flag not being set. Not really sure what the intended purpose of this flag is but currently, if there is a system provided eigen, it will always use that. To get the build work for me I just commented out some lines in the cmake such that it always runs the eigen cmake file and downloads its own copy. |
FYI, I made an issue for this: #22515 |
Actually, I had the latest release of libeigen3-dev 3.4.0-2ubuntu2. |
I have 3.4.0-2ubuntu2 version installed as well. I will try to remove the system package and try again. |
@ep1cman Can you tell us what changes did you do to the cmake files? Is it the same as suggested by @sevagh above |
Does it latest eigen version work? You may open cmake/deps.txt then search the eigen line and update it. The last column is the SHA1 sum of the source zip file. If it works. I will submit a PR to update it. |
I will try to compile it again. |
@snnn I can confirm that the issue is resolved( and as a plus the issue with the nsync has been resolved). I will close this issue. Thanks. |
I don't think you should close the issue, given that we all needed to use workarounds. The onnxruntime project itself needs to merge a fix first, right? |
Would the newly added vcpkg feature work for you? #21348 |
I am on Linux so I get an issue with
|
Finally I settled for removing my system Eigen3, which will make "use_preinstalled_eigen" work correctly 🤷 |
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
The text was updated successfully, but these errors were encountered: