open-mmlab / mmdeploy

OpenMMLab Model Deployment Framework
https://mmdeploy.readthedocs.io/en/latest/
Apache License 2.0
2.79k stars 639 forks source link

[Bug] win10 to build mmdeploy cpu+ onnxruntime , report csrc\mmdeploy\execution\utility.h(31): error C2833: “operator decltype”不是可识别的运算符或类型 \mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] #1550

Closed AllYoung closed 1 year ago

AllYoung commented 1 year ago

Checklist

Describe the bug

cmake is ok,log is as follow (base) PS D:\mmdeploy-master\build> cmake .. -G "Visual Studio 16 2019" -A x64 -T v142

-DMMDEPLOY_BUILD_SDK=ON `
-DMMDEPLOY_BUILD_EXAMPLES=ON `
-DMMDEPLOY_BUILD_SDK_PYTHON_API=ON `
-DMMDEPLOY_TARGET_DEVICES="cpu" `
-DMMDEPLOY_TARGET_BACKENDS="ort" `
-DONNXRUNTIME_DIR="$env:ONNXRUNTIME_DIR"

-- CMAKE_INSTALL_PREFIX: D:/mmdeploy-master/build/install -- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19045. -- Build ONNXRUNTIME custom ops. -- OpenCV ARCH: x64 -- OpenCV RUNTIME: vc15 -- OpenCV STATIC: OFF -- Found OpenCV 4.6.0 in D:/Program Files/opencv/opencv/build/x64/vc15/lib -- You might need to add D:\Program Files\opencv\opencv\build\x64\vc15\bin to your PATH to be able to run your applications. -- Build spdlog: 1.10.0 -- Build type: Release -- build codebase: mmcls -- build codebase: mmdet -- build codebase: mmseg -- build codebase: mmocr -- build codebase: mmedit -- build codebase: mmpose -- build codebase: mmrotate -- build codebase: mmaction -- pybind11 v2.9.0 dev1 -- OpenCV ARCH: x64 -- OpenCV RUNTIME: vc15 -- OpenCV STATIC: OFF -- Found OpenCV 4.6.0 in D:/Program Files/opencv/opencv/build/x64/vc15/lib -- You might need to add D:\Program Files\opencv\opencv\build\x64\vc15\bin to your PATH to be able to run your applications. -- Configuring done -- Generating done -- Build files have been written to: D:/mmdeploy-master/build`

cmake --build . --config Release -- /m report: `(base) PS D:\mmdeploy-master\build> cmake --build . --config Release -- /m 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.0.462+g62fb89029d 版权所有(C) Microsoft Corporation。保留所有权利。

spdlog.vcxproj -> D:\mmdeploy-master\build\lib\Release\spdlog.lib graph.cpp mmdeploy_onnxruntime_ops_obj.vcxproj -> D:\mmdeploy-master\build\csrc\mmdeploy\backend_ops\onnxruntime\mmdeploy_onnxruntime_ops_obj.dir\Release\mmdeploy_onnxruntime_ops_obj.lib D:\mmdeploy-master\csrc\mmdeploy/core/status_code.h(98): warning C4275: 非 dll 接口 class“system_error2::status_code_domain”用作 dll 接口 class“mmdeploy::StatusDomain”的基 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmde ploy_core.vcxproj] D:\mmdeploy-master\third_party\outcome\outcome-experimental.hpp(6598): note: 参见“system_error2::status_code_domain”的声明 D:\mmdeploy-master\csrc\mmdeploy/core/status_code.h(98): note: 参见“mmdeploy::StatusDomain”的声明 D:\mmdeploy-master\csrc\mmdeploy/core/model.h(27): warning C4003: 类函数宏的调用“_MMDEPLOY_PP_ARG_N”参数不足 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy/core/model.h(33): warning C4003: 类函数宏的调用“_MMDEPLOY_PP_ARG_N”参数不足 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(31): error C2833: “operator decltype”不是可识别的运算符或类型 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(32): note: 参见对正在编译的 类 模板 实例化 "mmdeploy::__conv" 的引用 D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(31): error C2059: 语法错误:“newline” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(31): error C2334: “{”的前面有意外标记;跳过明显的函数体 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(144): error C2059: 语法错误:“...” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(144): error C2947: 应由“>”终止 模板参数列表,却找到“>” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(144): error C2059: 语法错误:“常数” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(147): error C2334: “{”的前面有意外标记;跳过明显的函数体 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(160): error C2059: 语法错误:“...” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(160): error C2947: 应由“>”终止 模板参数列表,却找到“>” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(160): error C2059: 语法错误:“常数” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj] D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(163): error C2334: “{”的前面有意外标记;跳过明显的函数体 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]`

Reproduction

command : cmake --build . --config Release -- /m

Environment

win10,vs2019 professional,cmake3.23

Error traceback

`(base) PS D:\mmdeploy-master\build> cmake --build . --config Release -- /m
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.0.462+g62fb89029d
版权所有(C) Microsoft Corporation。保留所有权利。

  spdlog.vcxproj -> D:\mmdeploy-master\build\lib\Release\spdlog.lib
  graph.cpp
  mmdeploy_onnxruntime_ops_obj.vcxproj -> D:\mmdeploy-master\build\csrc\mmdeploy\backend_ops\onnxruntime\mmdeploy_onnxruntime_ops_obj.dir\Release\mmdeploy_onnxruntime_ops_obj.lib
D:\mmdeploy-master\csrc\mmdeploy/core/status_code.h(98): warning C4275: 非 dll 接口 class“system_error2::status_code_domain”用作 dll 接口 class“mmdeploy::StatusDomain”的基 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmde
ploy_core.vcxproj]
  D:\mmdeploy-master\third_party\outcome\outcome-experimental.hpp(6598): note: 参见“system_error2::status_code_domain”的声明
  D:\mmdeploy-master\csrc\mmdeploy/core/status_code.h(98): note: 参见“mmdeploy::StatusDomain”的声明
D:\mmdeploy-master\csrc\mmdeploy/core/model.h(27): warning C4003: 类函数宏的调用“_MMDEPLOY_PP_ARG_N”参数不足 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy/core/model.h(33): warning C4003: 类函数宏的调用“_MMDEPLOY_PP_ARG_N”参数不足 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(31): error C2833: “operator decltype”不是可识别的运算符或类型 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
  D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(32): note: 参见对正在编译的 类 模板 实例化 "mmdeploy::__conv<F>" 的引用
D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(31): error C2059: 语法错误:“newline” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\utility.h(31): error C2334: “{”的前面有意外标记;跳过明显的函数体 [D:\\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(144): error C2059: 语法错误:“...” [D:\\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(144): error C2947: 应由“>”终止 模板参数列表,却找到“>” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(144): error C2059: 语法错误:“常数” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(147): error C2334: “{”的前面有意外标记;跳过明显的函数体 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(160): error C2059: 语法错误:“...” [D:\\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(160): error C2947: 应由“>”终止 模板参数列表,却找到“>” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(160): error C2059: 语法错误:“常数” [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]
D:\mmdeploy-master\csrc\mmdeploy\execution\when_all.h(163): error C2334: “{”的前面有意外标记;跳过明显的函数体 [D:\mmdeploy-master\build\csrc\mmdeploy\core\mmdeploy_core.vcxproj]`
mm-assistant[bot] commented 1 year ago

We recommend using English or English & Chinese for issues so that we could have broader discussion.

irexyc commented 1 year ago

I used MSVC v142 - VS2019 C++ x64/x86 build tools (v14.29).

Which version are you using? You may try this version.

image
lzhangzz commented 1 year ago

@AllYoung Building the SDK requires standard-conforming preprocessor support, which is available on Visual Studio 2019 version 16.5 and later.

https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor?view=msvc-160

AllYoung commented 1 year ago

I used MSVC v142 - VS2019 C++ x64/x86 build tools (v14.29).

Which version are you using? You may try this version.

image

thank you for your reply. the MSVC v142 - VS2019 C++ x64/x86 build tools version is v14.20. i update my vs2019 build tools to version v14.29.

捕获

then ,the cmake version change to cmake version 3.20.21032501-MSVC_2. and I build again ,but i failed .

the log is dbnet.obj : error LNK2019: 无法解析的外部符号 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::DbHeadImpl> & __cde cl mmdeploy::mmocr::get_registry(struct mmdeploy::basic_type<class mmdeploy::mmocr::DbHeadImpl>)" (?get_registry@mmo cr@mmdeploy@@YAAEAV?$Registry@VDbHeadImpl@mmocr@mmdeploy@@@_registry@2@U?$basic_type@VDbHeadImpl@mmocr@mmdeploy@@@2@ @Z),函数 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::DbHeadImpl> & __cdecl mmdeploy::_registry::gRegis try<class mmdeploy::mmocr::DbHeadImpl>(void)" (??$gRegistry@VDbHeadImpl@mmocr@mmdeploy@@@_registry@mmdeploy@@YAAEAV? $Registry@VDbHeadImpl@mmocr@mmdeploy@@@01@XZ) 中引用了该符号 [D:\\mmdeploy-master\build\csrc\mmdeploy\codebase\m mocr\mmdeploy_mmocr.vcxproj] dbnet.obj : error LNK2001: 无法解析的外部符号 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::DbHeadImpl> & __cde cl mmdeploy::mmocr::get_registry(struct mmdeploy::basic_type<class mmdeploy::mmocr::DbHeadImpl>)" (?get_registry@mmo cr@mmdeploy@@YAAEAV?$Registry@VDbHeadImpl@mmocr@mmdeploy@@@_registry@2@U?$basic_type@VDbHeadImpl@mmocr@mmdeploy@@@2@ @Z) [D:\\mmdeploy-master\build\csrc\mmdeploy\codebase\mmocr\mmdeploy_mmocr.vcxproj] panet.obj : error LNK2019: 无法解析的外部符号 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::PaHeadImpl> & __cde cl mmdeploy::mmocr::get_registry(struct mmdeploy::basic_type<class mmdeploy::mmocr::PaHeadImpl>)" (?get_registry@mmo cr@mmdeploy@@YAAEAV?$Registry@VPaHeadImpl@mmocr@mmdeploy@@@_registry@2@U?$basic_type@VPaHeadImpl@mmocr@mmdeploy@@@2@ @Z),函数 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::PaHeadImpl> & __cdecl mmdeploy::_registry::gRegis try<class mmdeploy::mmocr::PaHeadImpl>(void)" (??$gRegistry@VPaHeadImpl@mmocr@mmdeploy@@@_registry@mmdeploy@@YAAEAV? $Registry@VPaHeadImpl@mmocr@mmdeploy@@@01@XZ) 中引用了该符号 [D:\\mmdeploy-master\build\csrc\mmdeploy\codebase\m mocr\mmdeploy_mmocr.vcxproj] panet.obj : error LNK2001: 无法解析的外部符号 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::PaHeadImpl> & __cde cl mmdeploy::mmocr::get_registry(struct mmdeploy::basic_type<class mmdeploy::mmocr::PaHeadImpl>)" (?get_registry@mmo cr@mmdeploy@@YAAEAV?$Registry@VPaHeadImpl@mmocr@mmdeploy@@@_registry@2@U?$basic_type@VPaHeadImpl@mmocr@mmdeploy@@@2@ @Z) [D:\\mmdeploy-master\build\csrc\mmdeploy\codebase\mmocr\mmdeploy_mmocr.vcxproj] psenet.obj : error LNK2019: 无法解析的外部符号 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::PseHeadImpl> & __c decl mmdeploy::mmocr::get_registry(struct mmdeploy::basic_type<class mmdeploy::mmocr::PseHeadImpl>)" (?get_registry@ mmocr@mmdeploy@@YAAEAV?$Registry@VPseHeadImpl@mmocr@mmdeploy@@@_registry@2@U?$basic_type@VPseHeadImpl@mmocr@mmdeploy @@@2@@Z),函数 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::PseHeadImpl> & __cdecl mmdeploy::_registry:: gRegistry<class mmdeploy::mmocr::PseHeadImpl>(void)" (??$gRegistry@VPseHeadImpl@mmocr@mmdeploy@@@_registry@mmdeploy@ @YAAEAV?$Registry@VPseHeadImpl@mmocr@mmdeploy@@@01@XZ) 中引用了该符号 [D:\\mmdeploy-master\build\csrc\mmdeploy\c odebase\mmocr\mmdeploy_mmocr.vcxproj] psenet.obj : error LNK2001: 无法解析的外部符号 "class mmdeploy::_registry::Registry<class mmdeploy::mmocr::PseHeadImpl> & __c decl mmdeploy::mmocr::get_registry(struct mmdeploy::basic_type<class mmdeploy::mmocr::PseHeadImpl>)" (?get_registry@ mmocr@mmdeploy@@YAAEAV?$Registry@VPseHeadImpl@mmocr@mmdeploy@@@_registry@2@U?$basic_type@VPseHeadImpl@mmocr@mmdeploy @@@2@@Z) [D:\\mmdeploy-master\build\csrc\mmdeploy\codebase\mmocr\mmdeploy_mmocr.vcxproj] D:\\mmdeploy-master\build\bin\Release\mmdeploy_mmocr.dll : fatal error LNK1120: 3 个无法解析的外部命令 [D:\Code_pyt hon\mmdeploy-master\build\csrc\mmdeploy\codebase\mmocr\mmdeploy_mmocr.vcxproj]

AllYoung commented 1 year ago

It is weird. mmdeploy_mmocr.dll build failed,but other dll file build successed.

屏幕截图_20221216_230949

install failed. log is `(base) PS D:\Code_python\mmdeploy-master\build> cmake --install . --config Release -- Up-to-date: D:/mmdeploy-master/mmdeploy/lib/mmdeploy_onnxruntime_ops.lib -- Up-to-date: D:/mmdeploy-master/mmdeploy/lib/mmdeploy_onnxruntime_ops.dll -- Installing: D:/mmdeploy-master/build/install/lib/spdlog.lib -- Installing: D:/mmdeploy-master/build/install/lib/mmdeploy_core.lib -- Installing: D:/mmdeploy-master/build/install/bin/mmdeploy_core.dll CMake Error at csrc/mmdeploy/execution/cmake_install.cmake:51 (file):

file INSTALL cannot find "D:/mmdeploy-master/build/bin/Release/mmdeploy_execution.dll": File exists.

Call Stack (most recent call first): csrc/mmdeploy/cmake_install.cmake:47 (include) cmake_install.cmake:37 (include)`

mmdeploy_mmocr.dll is not need in my project,can i remove it ? where should i to change ?

AllYoung commented 1 year ago

i build it succss. by changed file cmakelist.txt(https://github.com/open-mmlab/mmdeploy/blob/master/CMakeLists.txt) line41 before : set(MMDEPLOY_CODEBASES "all" CACHE STRING "select OpenMMLab codebases")

change to : set(MMDEPLOY_CODEBASES "mmcls;mmdet" CACHE STRING "select OpenMMLab codebases")

because i donnt use mmocr in my project. so i do this to skip the problem.