AgibotTech / agibot_x1_infer

The inference module for AgiBot X1.
https://www.zhiyuan-robot.com/products/X1
Other
1.05k stars 323 forks source link

编译onnxruntime 出现EIGEN问题 #2

Open CTGUMARK opened 6 days ago

CTGUMARK commented 6 days ago

/home/wu/slam_ws/src/clean_ws/src/tmp_ws/src/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<float, -1, 1>, 0, Eigen::Stride<0, 0> > >]’ 855 | per_iter_bh.EigenInput0().array().template max(per_iter_bh.ScalarInput1()); | ~~~~~~~~~~~~~~^~~~~~~ /home/wu/slam_ws/src/clean_ws/src/tmp_ws/src/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:855:85: note: expected a type, got ‘Eigen::PropagateNaN’ /home/wu/slam_ws/src/clean_ws/src/tmp_ws/src/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<float, -1, 1>, 0, Eigen::Stride<0, 0> > >::max(Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<float, -1, 1>, 0, Eigen::Stride<0, 0> > >)’ 859 | per_iter_bh.EigenInput0().array().template max( | ~~~~~~~~~~~~~~^ 860 | per_iter_bh.EigenInput1().array()); | ~~~~~~~~~

怎么确定依赖的eigen版本问题 感谢

DongPF1992 commented 5 days ago

/home/wu/slam_ws/src/clean_ws/src/tmp_ws/src/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<float, -1, 1>, 0, Eigen::Stride<0, 0> > >]’ 855 | per_iter_bh.EigenInput0().array().template maxEigen::PropagateNaN(per_iter_bh.ScalarInput1()); | ~~~~~~~~~~~~~~^~~~~~~ /home/wu/slam_ws/src/clean_ws/src/tmp_ws/src/onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:855:85: note: expected a type, got ‘Eigen::PropagateNaN’ /home/wu/slam_ws/src/clean_ws/src/tmp_ws/src/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<float, -1, 1>, 0, Eigen::Stride<0, 0> > >::maxEigen::PropagateNaN(Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<float, -1, 1>, 0, Eigen::Stride<0, 0> > >)’ 859 | per_iter_bh.EigenInput0().array().template maxEigen::PropagateNaN( | ~~~~~~~~~~~~~~^ 860 | per_iter_bh.EigenInput1().array()); | ~~~~~~~~~

怎么确定依赖的eigen版本问题 感谢

遇到了类似的编译问题,通过删除该文件中所有“”代码后编译通过,希望可以帮到你。

RichieStyle commented 5 days ago

感谢您提出的问题 工程中使用的是 3.4.0 版本的 Eigen库,稍后更新依赖文档

fwd4 commented 2 days ago

Try the patch below:

diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
index a69d2649ad..ca14cbf743 100644
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
@@ -522,7 +522,7 @@ if(TARGET ONNX::onnx_proto AND NOT TARGET onnx_proto)
   add_library(onnx_proto ALIAS ONNX::onnx_proto)
 endif()

-find_package(Eigen3 CONFIG)
+#find_package(Eigen3 CONFIG)
 if(Eigen3_FOUND)
   get_target_property(eigen_INCLUDE_DIRS Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
 else()
diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py
index 85eb3ddad3..133f7d32aa 100644
--- a/tools/ci_build/build.py
+++ b/tools/ci_build/build.py
@@ -1250,8 +1250,8 @@ def generate_build_tree(
         nvml_stub_path = cuda_home + "/lib64/stubs"
         cmake_args += ["-DCUDA_CUDA_LIBRARY=" + nvml_stub_path]

-    if args.use_preinstalled_eigen:
-        cmake_args += ["-Donnxruntime_USE_PREINSTALLED_EIGEN=ON", "-Deigen_SOURCE_PATH=" + args.eigen_path]
+    # if args.use_preinstalled_eigen:
+    #     cmake_args += ["-Donnxruntime_USE_PREINSTALLED_EIGEN=ON", "-Deigen_SOURCE_PATH=" + args.eigen_path]

     if args.nnapi_min_api:
         cmake_args += ["-Donnxruntime_NNAPI_MIN_API=" + str(args.nnapi_min_api)]