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 during build: 'onnx' does not name a type #806

Open
Kurayuri opened this issue May 13, 2024 · 2 comments
Open

Error during build: 'onnx' does not name a type #806

Kurayuri opened this issue May 13, 2024 · 2 comments
Labels

Comments

@Kurayuri
Copy link

I try to follow the instructions to build Marabou. After excuting:

cmake --build ./

, it shows as following.

I have tried in different envs, but all failed in the same way.
Env 1:
Ubuntu 22.04
cmake 3.22.1
Env 2:
Ubuntu 22.04 in conda
cmake 3.22.1
Env 3:
Ubuntu 20.04 in docker
cmake 3.16.3

The log file during cmake ../.
cmake.log
The log file during cmake --build ./.
cmake_build.log

Please ask if you need any more information. Thanks a lot!

[  2%] Building CXX object CMakeFiles/MarabouHelper.dir/src/engine/DnCMarabou.cpp.o
In file included from /root/Marabou/src/engine/DnCMarabou.cpp:24:
/root/Marabou/src/input_parsers/OnnxParser.h:48:5: error: 'onnx' does not name a type
   48 |     onnx::GraphProto _network;
      |     ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:80:32: error: 'onnx' has not been declared
   80 |     void makeMarabouEquations( onnx::NodeProto &node, bool makeEquations );
      |                                ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:81:34: error: 'onnx' has not been declared
   81 |     Set<String> getInputsToNode( onnx::NodeProto &node );
      |                                  ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:82:10: error: 'onnx' was not declared in this scope
   82 |     List<onnx::NodeProto> getNodesWithOutput( String &nodeName );
      |          ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:82:25: error: template argument 1 is invalid
   82 |     List<onnx::NodeProto> getNodesWithOutput( String &nodeName );
      |                         ^
/root/Marabou/src/input_parsers/OnnxParser.h:88:45: error: 'onnx' does not name a type
   88 |     void insertConstant( String name, const onnx::TensorProto &tensor, TensorShape shape );
      |                                             ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:88:63: error: expected unqualified-id before '&' token
   88 |     void insertConstant( String name, const onnx::TensorProto &tensor, TensorShape shape );
      |                                                               ^
/root/Marabou/src/input_parsers/OnnxParser.h:88:62: error: expected ')' before '&' token
   88 |     void insertConstant( String name, const onnx::TensorProto &tensor, TensorShape shape );
      |                        ~                                     ^~
      |                                                              )
/root/Marabou/src/input_parsers/OnnxParser.h:88:63: error: expected ';' at end of member declaration
   88 |     void insertConstant( String name, const onnx::TensorProto &tensor, TensorShape shape );
      |                                                               ^
      |                                                                ;
/root/Marabou/src/input_parsers/OnnxParser.h:88:64: error: 'tensor' does not name a type
   88 |     void insertConstant( String name, const onnx::TensorProto &tensor, TensorShape shape );
      |                                                                ^~~~~~
/root/Marabou/src/input_parsers/OnnxParser.h:90:20: error: 'onnx' has not been declared
   90 |     void constant( onnx::NodeProto &node );
      |                    ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:91:20: error: 'onnx' has not been declared
   91 |     void identity( onnx::NodeProto &node );
      |                    ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:92:19: error: 'onnx' has not been declared
   92 |     void dropout( onnx::NodeProto &node );
      |                   ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:93:16: error: 'onnx' has not been declared
   93 |     void cast( onnx::NodeProto &node );
      |                ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:94:19: error: 'onnx' has not been declared
   94 |     void reshape( onnx::NodeProto &node );
      |                   ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:95:19: error: 'onnx' has not been declared
   95 |     void squeeze( onnx::NodeProto &node );
      |                   ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:96:21: error: 'onnx' has not been declared
   96 |     void unsqueeze( onnx::NodeProto &node );
      |                     ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:97:19: error: 'onnx' has not been declared
   97 |     void flatten( onnx::NodeProto &node );
      |                   ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:98:21: error: 'onnx' has not been declared
   98 |     void transpose( onnx::NodeProto &node );
      |                     ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:99:30: error: 'onnx' has not been declared
   99 |     void batchNormEquations( onnx::NodeProto &node, bool makeEquations );
      |                              ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:100:28: error: 'onnx' has not been declared
  100 |     void maxPoolEquations( onnx::NodeProto &node, bool makeEquations );
      |                            ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:101:25: error: 'onnx' has not been declared
  101 |     void convEquations( onnx::NodeProto &node, bool makeEquations );
      |                         ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:102:25: error: 'onnx' has not been declared
  102 |     void gemmEquations( onnx::NodeProto &node, bool makeEquations );
      |                         ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:103:32: error: 'onnx' has not been declared
  103 |     void scaleAndAddEquations( onnx::NodeProto &node,
      |                                ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:107:27: error: 'onnx' has not been declared
  107 |     void matMulEquations( onnx::NodeProto &node, bool makeEquations );
      |                           ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:108:25: error: 'onnx' has not been declared
  108 |     void reluEquations( onnx::NodeProto &node, bool makeEquations );
      |                         ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:109:30: error: 'onnx' has not been declared
  109 |     void leakyReluEquations( onnx::NodeProto &node, bool makeEquations );
      |                              ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:110:28: error: 'onnx' has not been declared
  110 |     void sigmoidEquations( onnx::NodeProto &node, bool makeEquations );
      |                            ^~~~
/root/Marabou/src/input_parsers/OnnxParser.h:111:25: error: 'onnx' has not been declared
  111 |     void tanhEquations( onnx::NodeProto &node, bool makeEquations );
      |                         ^~~~
make[2]: *** [CMakeFiles/MarabouHelper.dir/build.make:427: CMakeFiles/MarabouHelper.dir/src/engine/DnCMarabou.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:931: CMakeFiles/MarabouHelper.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
@Kurayuri
Copy link
Author

I have identified the cause of the issue. I apologize for any inconvenience caused.
The problem actually occurred when executing cmake ...
The tools/download_onnx.sh script called by CMakeLists.txt includes the command:
wget -q https://raw.githubusercontent.com/onnx/onnx/v$version/onnx/onnx.proto3 -O onnx.proto3

However, due to my network, the file tools/onnx-1.15.0/onnx.proto3 downloaded by wget was empty. This led to an incorrect execution of the command:
../$protobufdir/installed/bin/protoc --cpp_out=. onnx.proto3

, resulting in the warning message:
[libprotobuf WARNING google/protobuf/compiler/parser.cc:649] No syntax specified for the proto file: onnx.proto3. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
and incorrect generation of files tools/onnx-1.15.0/onnx.proto3.pb.h and tools/onnx-1.15.0/onnx.proto3.pb.cc
(since these two files were not empty, I did not notice the issue earlier).

I would like to request adding exception handling to script tools/download_onnx.sh to handle cases, like wget failing to download, in order to prevent the same issue from occurring again.

@wu-haoze
Copy link
Collaborator

Hi @Kurayuri , good to know the issue is resolved. And that's a good point. Perhaps we can add a check to see if wget's download is successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants