Closed sconde closed 2 years ago
Change director to /home/sconde/Downloads/onnxruntime_repo/cmake/external/onnx and run "git log". What's the commit id on the top?
Does it contain this PR: https://github.com/onnx/onnx/pull/3882 ?
If yes, delete your build folder and run "git submodule update --init --recursive", then build onnx runtime again.
The log did contain the PR. and Following your instructions, I'm now able to complete the build. Thank you.
i have the same error posted in above, but my try is build against system onnx (from git, 94e2f6455 (1.11.0)) as shared library, instead off pull the onnx sources as submodule
my changes in onnxruntime: (i'm not coder, so you can expect garbage)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index acbde7f56a..da8e29f2d7 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -1382,19 +1390,24 @@ else()
set(ONNX_USE_LITE_PROTO OFF CACHE BOOL "" FORCE)
endif()
-if (NOT onnxruntime_MINIMAL_BUILD)
- add_subdirectory(external/onnx EXCLUDE_FROM_ALL)
+if (onnxruntime_PREFER_SYSTEM_LIB)
+ find_package(ONNX)
+ target_link_libraries(onnx INTERFACE onnx)
+ target_link_libraries(onnx_proto INTERFACE onnx_proto)
else()
- include(onnx_minimal)
-endif()
+ if (NOT onnxruntime_MINIMAL_BUILD)
+ add_subdirectory(external/onnx EXCLUDE_FROM_ALL)
+ else()
+ include(onnx_minimal)
+ endif()
-target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
-if (NOT onnxruntime_USE_FULL_PROTOBUF)
- target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
+ target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
+ if (NOT onnxruntime_USE_FULL_PROTOBUF)
+ target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
+ endif()
+ set_target_properties(onnx PROPERTIES FOLDER "External/ONNX")
+ set_target_properties(onnx_proto PROPERTIES FOLDER "External/ONNX")
endif()
-set_target_properties(onnx PROPERTIES FOLDER "External/ONNX")
-set_target_properties(onnx_proto PROPERTIES FOLDER "External/ONNX")
-
# fix a warning in onnx code we can't do anything about
if (MSVC)
the output:
[ 5%] Building CXX object CMakeFiles/onnxruntime_graph.dir/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc.o
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:25:7: error: redefinition of 'class onnx::FunctionBuilder'
25 | class FunctionBuilder {
| ^~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:110:7: note: previous definition of 'class onnx::FunctionBuilder'
110 | class FunctionBuilder {
| ^~~~~~~~~~~~~~~
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc: In lambda function:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:847:19: error: no matching function for call to 'onnx::FunctionBuilder::Const(const char [2], double, int&)'
845 | builder
| ~~~~~~~
846 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
847 | .Const("a", 0.5, elem_type)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:157:20: note: candidate: 'template<class T> onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, T)'
157 | FunctionBuilder& Const(const std::string& name, T const_value) {
| ^~~~~
/usr/include/onnx/defs/function.h:157:20: note: template argument deduction/substitution failed:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:847:19: note: candidate expects 2 arguments, 3 provided
845 | builder
| ~~~~~~~
846 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
847 | .Const("a", 0.5, elem_type)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:175:20: note: candidate: 'template<class T> onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, const std::vector<T>&)'
175 | FunctionBuilder& Const(const std::string& name, const std::vector<T>& values) {
| ^~~~~
/usr/include/onnx/defs/function.h:175:20: note: template argument deduction/substitution failed:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:847:19: note: mismatched types 'const std::vector<T>' and 'double'
845 | builder
| ~~~~~~~
846 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
847 | .Const("a", 0.5, elem_type)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:149:20: note: candidate: 'onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, const onnx::TensorProto&)'
149 | FunctionBuilder& Const(const std::string& name, const TensorProto& tensor) {
| ^~~~~
/usr/include/onnx/defs/function.h:149:20: note: candidate expects 2 arguments, 3 provided
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc: In lambda function:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:2597:23: error: no matching function for call to 'onnx::FunctionBuilder::Const(const char [8], float&, int64_t&)'
2595 | builder
| ~~~~~~~
2596 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
2597 | .Const("Epsilon", epsilon, U)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:157:20: note: candidate: 'template<class T> onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, T)'
157 | FunctionBuilder& Const(const std::string& name, T const_value) {
| ^~~~~
/usr/include/onnx/defs/function.h:157:20: note: template argument deduction/substitution failed:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:2597:23: note: candidate expects 2 arguments, 3 provided
2595 | builder
| ~~~~~~~
2596 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
2597 | .Const("Epsilon", epsilon, U)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:175:20: note: candidate: 'template<class T> onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, const std::vector<T>&)'
175 | FunctionBuilder& Const(const std::string& name, const std::vector<T>& values) {
| ^~~~~
/usr/include/onnx/defs/function.h:175:20: note: template argument deduction/substitution failed:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:2597:23: note: mismatched types 'const std::vector<T>' and 'float'
2595 | builder
| ~~~~~~~
2596 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
2597 | .Const("Epsilon", epsilon, U)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:149:20: note: candidate: 'onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, const onnx::TensorProto&)'
149 | FunctionBuilder& Const(const std::string& name, const TensorProto& tensor) {
| ^~~~~
/usr/include/onnx/defs/function.h:149:20: note: candidate expects 2 arguments, 3 provided
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc: In lambda function:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:2715:19: error: no matching function for call to 'onnx::FunctionBuilder::Const(const char [5], double, int&)'
2713 | builder
| ~~~~~~~
2714 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
2715 | .Const("Half", 0.5, elem_type)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:157:20: note: candidate: 'template<class T> onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, T)'
157 | FunctionBuilder& Const(const std::string& name, T const_value) {
| ^~~~~
/usr/include/onnx/defs/function.h:157:20: note: template argument deduction/substitution failed:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:2715:19: note: candidate expects 2 arguments, 3 provided
2713 | builder
| ~~~~~~~
2714 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
2715 | .Const("Half", 0.5, elem_type)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:175:20: note: candidate: 'template<class T> onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, const std::vector<T>&)'
175 | FunctionBuilder& Const(const std::string& name, const std::vector<T>& values) {
| ^~~~~
/usr/include/onnx/defs/function.h:175:20: note: template argument deduction/substitution failed:
/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:2715:19: note: mismatched types 'const std::vector<T>' and 'double'
2713 | builder
| ~~~~~~~
2714 | .AddOpset("", 13)
| ~~~~~~~~~~~~~~~~~
2715 | .Const("Half", 0.5, elem_type)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:11,
from /tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc:21:
/usr/include/onnx/defs/function.h:149:20: note: candidate: 'onnx::FunctionBuilder& onnx::FunctionBuilder::Const(const string&, const onnx::TensorProto&)'
149 | FunctionBuilder& Const(const std::string& name, const TensorProto& tensor) {
| ^~~~~
/usr/include/onnx/defs/function.h:149:20: note: candidate expects 2 arguments, 3 provided
make[2]: *** [CMakeFiles/onnxruntime_graph.dir/build.make:90: CMakeFiles/onnxruntime_graph.dir/tmp/makepkg/python-onnxruntime/src/onnxruntime/onnxruntime/core/graph/contrib_ops/contrib_defs.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:949: CMakeFiles/onnxruntime_graph.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
greetings
It would be great if one onnxruntime version could be compatible with multiple onnx versions, but it is too costly. When @liqunfu upgrade the version of onnx in onnx runtime master from 1.10 to 1.11, he spent two months. It was a very big change. So I don't expect another ONNX version could work.
Hi
then, onnxruntime from git is compatible with what version of onnx?
submodules do this
https://github.com/microsoft/onnxruntime/blob/master/.gitmodules#L10-L12
wich point to https://github.com/onnx/onnx/tree/850a81b0b77786bf99ea90580242b084f86a6235, and i what to build with https://github.com/onnx/onnx/tree/9521ab161cfa555b93bf2c2084dc69cc50e30356, wich is 10 commits ahead
the link in # points to older commit than pulled by onnxruntime git
greetings
then, onnxruntime from git is compatible with what version of onnx?
The one in https://github.com/microsoft/onnxruntime/tree/master/cmake/external
hi, rollback my onnx installation to 850a81b0b77786bf99ea90580242b084f86a6235. still have the same issue
greetings
*note: if you ask why 850a81b0b77786bf99ea90580242b084f86a6235, is because
What's your onnxruntime version? If it is 1.10, then you should get onnx version from https://github.com/microsoft/onnxruntime/tree/rel-1.10.0/cmake/external. If it is 1.11, then you should get onnx version from https://github.com/microsoft/onnxruntime/tree/rel-1.11.0/cmake/external (850a81b0b77786bf99ea90580242b084f86a6235 is the one you are looking for.) Currently the the latest master uses the same ONNX version as ONNX Runtime 1.11 which is not released yet.
EDIT: 3c5853dcbc9d5dda2476afa8c6105802d2b8e53d is the latest commit i try to build
Describe the bug Attempting to compile
rel-1.10.0
with the following config:produces a compiler error:
/onnxruntime/core/graph/contrib_ops/onnx_function_util.h:25:7: error: redefinition of 'FunctionBuilder'
. See the make log fileand CMakeCache.txt
Switching to current master/rel-1.11.0 does not produce the same error. So it appears the error is with version
rel-1.10.0
.Urgency If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none.
System information
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.