Skip to content
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

error when make converter folder #4

Closed
whatlas opened this issue May 6, 2019 · 6 comments
Closed

error when make converter folder #4

whatlas opened this issue May 6, 2019 · 6 comments

Comments

@whatlas
Copy link

whatlas commented May 6, 2019

try to compile MNN on my x64 PC with WSL environment. The Ubuntu version is 18.04 from Microsoft store, with libprotobuf 3.0.0.9 installed by apt-get.
this script https://github.com/alibaba/MNN/blob/master/doc/Install_EN.md can be compiled without any error. but when I try to compile converter folder, errors occur like

In file included from /mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/ArgMaxTf.cpp:9:0:
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:55:14: error: ‘function’ in namespace ‘std’ does not name a template type
typedef std::function<bool(const NodeDef& node, const OpTypePattern& pattern, const NodeMatch* match)>
^~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:60:45: error: ‘match_constraint_fun’ has not been declared
GraphMatcher(const GraphDef& graph_def, match_constraint_fun func);
^~~~~~~~~~~~~~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:62:37: error: ‘match_constraint_fun’ has not been declared
void SetMatchConstraintFunction(match_constraint_fun func);
^~~~~~~~~~~~~~~~~~~~
[ 10%] Building CXX object source/onnx/CMakeFiles/onnx.dir/BinaryOpOnnx.cpp.o
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:72:5: error: ‘match_constraint_fun’ does not name a type
match_constraint_fun match_constraint_;
^~~~~~~~~~~~~~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:78:16: error: ‘function’ in namespace ‘std’ does not name a template type
const std::function<int(const NodeMatch&, const std::setstd::string&, const std::setstd::string&,
^~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:78:24: error: expected ‘,’ or ‘...’ before ‘<’ token
const std::function<int(const NodeMatch&, const std::setstd::string&, const std::setstd::string&,
^
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:144:14: error: ‘function’ in namespace ‘std’ does not name a template type
typedef std::function<int(const GraphDef&, const TransformFuncContext& context, GraphDef*)> TransformFunc;
^~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:146:31: error: ‘TransformFunc’ was not declared in this scope
typedef std::map<std::string, TransformFunc> TransformRegistry;
^~~~~~~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:146:31: note: suggested alternative: ‘TransformFuncContext’
typedef std::map<std::string, TransformFunc> TransformRegistry;
^~~~~~~~~~~~~
TransformFuncContext
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:146:44: error: template argument 2 is invalid
typedef std::map<std::string, TransformFunc> TransformRegistry;
^
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:146:44: error: template argument 4 is invalid
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:150:49: error: ‘TransformFunc’ has not been declared
TransformRegistrar(const std::string& name, TransformFunc transform_func) {
^~~~~~~~~~~~~
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp: In constructor ‘TFModelOptimizer::TransformRegistrar::TransformRegistrar(const string&, int)’:
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/TfUtils.hpp:152:30: error: no match for ‘operator[]’ (operand types are ‘int’ and ‘const string {aka const std::__cxx11::basic_string}’)
(*transform_registry)[name] = transform_func;
^
[ 11%] Linking CXX static library libCOMMON_LIB.a
[ 11%] Built target COMMON_LIB
[ 12%] Building CXX object source/tflite/CMakeFiles/tflite.dir/ConvolutionTflite.cpp.o
source/tensorflow/CMakeFiles/tensorflow.dir/build.make:142: recipe for target 'source/tensorflow/CMakeFiles/tensorflow.dir/ArgMaxTf.cpp.o' failed

then I add #include <functional> to tfUtils.hpp to fix this error. but got this

/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/SplitTf.cpp: In member function ‘virtual void SplitVTf::run(MNN::OpT*, TmpNode*, TmpGraph*)’:
/mnt/d/3rdparty/MNN/tools/converter/source/tensorflow/SplitTf.cpp:106:53: error: no match for ‘operator[]’ (operand types are ‘const google::protobuf::RepeatedField’ and ‘int’)
splitvParam->axis = value.tensor().int_val()[0];
^
source/tensorflow/CMakeFiles/tensorflow.dir/build.make:1462: recipe for target 'source/tensorflow/CMakeFiles/tensorflow.dir/SplitTf.cpp.o' failed
make[2]: *** [source/tensorflow/CMakeFiles/tensorflow.dir/SplitTf.cpp.o] Error 1
CMakeFiles/Makefile2:202: recipe for target 'source/tensorflow/CMakeFiles/tensorflow.dir/all' failed
make[1]: *** [source/tensorflow/CMakeFiles/tensorflow.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

can I get any help ? seems its a protobuf problem but I cannot get the reason.

@czy2014hust
Copy link
Collaborator

Could you upgrade protobuf? Probably protobuf version result in this error, you can try protobuf version@3.6.

li-qing pushed a commit that referenced this issue May 6, 2019
@li-qing li-qing closed this as completed May 6, 2019
@li-qing li-qing reopened this May 6, 2019
@li-qing
Copy link
Contributor

li-qing commented May 6, 2019

it's not a protobuf problem. we include a copy of protobuf in 3rd_party folder, and which is used in generating headers from protos.

run schema/generate.sh before building converter, and make sure no error occurs.

@whatlas
Copy link
Author

whatlas commented May 6, 2019

it's not a protobuf problem. we include a copy of protobuf in 3rd_party folder, and which is used in generating headers from protos.

run schema/generate.sh before building converter, and make sure no error occurs.

I run this script and got these errors

./schema/generate.sh: line 9: pushd: ../3rd_party/flatbuffers: No such file or directory
./schema/generate.sh: line 17: popd: directory stack empty
*** cleaning up ***
*** generating fbs under default ***
find: ‘../default/*.fbs’: No such file or directory
../../3rd_party/flatbuffers/tmp/flatc: error: missing input files

but I can still compile MNN root folder without any problem, this issue only occurs in converter folder

@li-qing
Copy link
Contributor

li-qing commented May 7, 2019

I see ...

please follow install.md's guide -- "cd schema && ./generate.sh && cd ..",

not "./schema/generate.sh", so that path error will be fixed.

consider to make the shell compatible later.

@li-qing li-qing closed this as completed May 7, 2019
@whatlas
Copy link
Author

whatlas commented May 7, 2019

I see ...

please follow install.md's guide -- "cd schema && ./generate.sh && cd ..",

not "./schema/generate.sh", so that path error will be fixed.

consider to make the shell compatible later.

thks, now cmake in root folder makes no misktake ,BUT the converter folder cannot be compiled yet, just as i wrote in this issue, MNN/tools/converter/source/tensorflow/SplitTf.cpp:106:53: error: no match for ‘operator[]’ (operand types are ‘const google::protobuf::RepeatedField<int>’ and ‘int’), it looks definitely like a protobuf problem

@whatlas
Copy link
Author

whatlas commented May 7, 2019

solved this problem by changing file tools\converter\source\tensorflow\SplitTf.cpp line 106

splitvParam->axis = value.tensor().int_val()[0];

to

splitvParam->axis = value.tensor().int_val(0);

now everything works.

jxt1234 pushed a commit that referenced this issue May 23, 2020
jxt1234 pushed a commit that referenced this issue Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants