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

Cannot build using Mingw #6506

Open
joda01 opened this issue Oct 31, 2024 · 2 comments
Open

Cannot build using Mingw #6506

joda01 opened this issue Oct 31, 2024 · 2 comments
Labels

Comments

@joda01
Copy link

joda01 commented Oct 31, 2024

Bug Report

Describe the bug

It is not possible to build onnx lib using Mingw because windows.h defines a macro named OPTIONAL which is used as variable name in the onnx lib. This leads to a compiler error.

System information

  • Windows Server 2022
  • ONNX 1.72, 1.16.2
  • mingw 13.2
  • CMake 3.30.5

Reproduction instructions

Try to build onnx static lib using cmake and windows

Expected behavior

Build ONNX library successfully.

Notes

Relates to #1065
Relates to conan-io/conan-center-index#25468

Logs

Click to expand log
onnx/1.16.2: Running CMake.build()
...
[ 35%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/controlflow/defs.cc.obj
In file included from /src/onnx/onnx-data_pb.h:9,
                 from /src/onnx/checker.h:15,
                 from /src/onnx/common/path.h:20,
                 from src\onnx\common\path.cc:7:
/build/Release/onnx/onnx-data.pb.h:259:38: error: expected unqualified-id before '=' token
  259 |   static constexpr DataType OPTIONAL =
      |                                      ^
/build/Release/onnx/onnx-data.pb.h:827:38: error: expected unqualified-id before '=' token
  827 |   static constexpr DataType OPTIONAL =
      |                                      ^
mingw32-make[2]: *** [CMakeFiles\onnx.dir\build.make:151: CMakeFiles/onnx.dir/onnx/common/path.cc.obj] Error 1
mingw32-make[2]: *** Waiting for unfinished jobs....
mingw32-make[1]: *** [CMakeFiles\Makefile2:193: CMakeFiles/onnx.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2

onnx/1.16.2: ERROR:
@andife
Copy link
Member

andife commented Nov 25, 2024

Many thanks for the find.

@justinchuby I wonder if an additional test can be added to the CI pipeline to test whether building with mingw works. It could only run once a week, for example.

@justinchuby
Copy link
Contributor

Many thanks for the find.

@justinchuby I wonder if an additional test can be added to the CI pipeline to test whether building with mingw works. It could only run once a week, for example.

We may do that if anyone wants to contribute? Though I’m not sure how much effort is required to maintain it

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

3 participants