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

[onnx] onnx/1.16.2: Cannot build using Mingw #25468

Open
joda01 opened this issue Sep 30, 2024 · 0 comments
Open

[onnx] onnx/1.16.2: Cannot build using Mingw #25468

joda01 opened this issue Sep 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@joda01
Copy link
Contributor

joda01 commented Sep 30, 2024

Description

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.

Package and Environment Details

  • Package Name/Version: onnx/1.16.2
  • Operating System+version: Windows
  • Compiler+version: GCC 12
  • Docker image: conanio/gcc12
  • Conan version: conan 2.7.1
  • Python version: Python 3.11.2

Conan profile

[settings]
os=Windows
compiler=gcc
compiler.version=12
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.exception=seh
arch=x86_64
build_type=Release

[tool_requires]
mingw-builds/13.2.0

Steps to reproduce

conan install -r conancenter onnx/1.16.2

Logs

Click to expand log
-------- Installing package onnx/1.16.2 (26 of 28) --------
onnx/1.16.2: Building from source
onnx/1.16.2: Package onnx/1.16.2:bae4ae3f17ae3c89e379d898e7f8c77ac13e15e7
onnx/1.16.2: Copying sources to build folder
onnx/1.16.2: Building your package in C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b
onnx/1.16.2: Calling generate()
onnx/1.16.2: Generators folder: C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\build\Release\generators
onnx/1.16.2: CMakeToolchain generated: conan_toolchain.cmake
onnx/1.16.2: CMakeToolchain generated: C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\build\Release\generators\CMakePresets.json
onnx/1.16.2: CMakeToolchain generated: C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\src\CMakeUserPresets.json
onnx/1.16.2: Generating aggregated env files
onnx/1.16.2: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
onnx/1.16.2: Calling build()
onnx/1.16.2: apply_conandata_patches(): No patches defined in conandata
onnx/1.16.2: Running CMake.configure()
onnx/1.16.2: RUN: cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/p" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/src"
-- Using Conan toolchain: C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Defining architecture flag: -m64
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/runneradmin/.conan2/p/mingwf3629a0c4f698/p/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/runneradmin/.conan2/p/mingwf3629a0c4f698/p/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:107 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: C:/hostedtoolcache/windows/Python/3.10.11/x64/python.exe (found version "3.10.11")
-- Conan: Component target declared 'protobuf::libprotobuf'
-- Conan: Component target declared 'protobuf::libprotoc'
-- Conan: Target declared 'protobuf::protobuf'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Conan: Including build module from 'C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf/protobuf-generate.cmake'
-- Conan: Including build module from 'C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf/protobuf-module.cmake'
-- Conan: Including build module from 'C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf/protobuf-options.cmake'
-- Conan: Including build module from 'C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf/protobuf-conan-protoc-target.cmake'
-- ONNX_PROTOC_EXECUTABLE: C:/Users/runneradmin/.conan2/p/proto86[250](https://github.com/joda01/imagec/actions/runs/11099084597/job/30832740679#step:6:251)22988b17/p/bin/protoc.exe
-- Protobuf_VERSION: 3.21.12
Generated: C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-ml.proto
Generated: C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-operators-ml.proto
Generated: C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-data.proto
-- 
-- ******** Summary ********
--   CMake version                     : 3.30.3
--   CMake command                     : C:/Program Files/CMake/bin/cmake.exe
--   System                            : Windows
--   C++ compiler                      : C:/Users/runneradmin/.conan2/p/mingwf3629a0c4f698/p/bin/g++.exe
--   C++ compiler version              : 13.2.0
--   CXX flags                         : -m64 -Wnon-virtual-dtor
--   Build type                        : Release
--   Compile definitions               : __STDC_FORMAT_MACROS
--   CMAKE_PREFIX_PATH                 : C:/Users/runneradmin/.conan2/p/b/onnx8d460[259](https://github.com/joda01/imagec/actions/runs/11099084597/job/30832740679#step:6:260)1d608/b/build/Release/generators;C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf;C:/Users/runneradmin/.conan2/p/proto8625022988b17/p/lib/cmake/protobuf
--   CMAKE_INSTALL_PREFIX              : C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/p
--   CMAKE_MODULE_PATH                 : C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf;C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/generators;C:/Users/runneradmin/.conan2/p/b/protod8894492ba62b/p/lib/cmake/protobuf;C:/Users/runneradmin/.conan2/p/proto8625022988b17/p/lib/cmake/protobuf
-- 
--   ONNX version                      : 1.16.2
--   ONNX NAMESPACE                    : onnx
--   ONNX_USE_LITE_PROTO               : False
--   USE_PROTOBUF_SHARED_LIBS          : False
--   Protobuf_USE_STATIC_LIBS          : ON
--   ONNX_DISABLE_EXCEPTIONS           : OFF
--   ONNX_DISABLE_STATIC_REGISTRATION  : True
--   ONNX_WERROR                       : OFF
--   ONNX_BUILD_TESTS                  : OFF
--   ONNX_BUILD_BENCHMARKS             : OFF
--   ONNX_BUILD_SHARED_LIBS            : 
--   BUILD_SHARED_LIBS                 : OFF
-- 
--   Protobuf compiler                 : C:/Users/runneradmin/.conan2/p/proto8625022988b17/p/bin/protoc.exe
--   Protobuf includes                 : 
--   Protobuf libraries                : 
--   BUILD_ONNX_PYTHON                 : OFF
-- Configuring done (5.2s)
-- Generating done (0.1s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_SH


-- Build files have been written to: C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release

onnx/1.16.2: Running CMake.build()
onnx/1.16.2: RUN: cmake --build "C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\build\Release" -- -j4
[  1%] Running gen_proto.py on onnx/onnx.in.proto
Processing C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\src\onnx\onnx.in.proto
Writing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-ml.proto
Writing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-ml.proto3
Generate pb3 code using C:/Users/runneradmin/.conan2/p/proto8625022988b17/p/bin/protoc.exe
Removing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-ml.proto3.pb.cc
Removing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-ml.proto3.pb.h
generating C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx_pb.py
[  2%] Running C++ protocol buffer compiler on C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-ml.proto
[  2%] Built target gen_onnx_proto
[  5%] Running gen_proto.py on onnx/onnx-data.in.proto
[  5%] Running gen_proto.py on onnx/onnx-operators.in.proto
Processing C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\src\onnx\onnx-operators.in.proto
Writing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-operators-ml.proto
Writing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-operators-ml.proto3
Generate pb3 code using C:/Users/runneradmin/.conan2/p/proto862502[298](https://github.com/joda01/imagec/actions/runs/11099084597/job/30832740679#step:6:299)8b17/p/bin/protoc.exe
Removing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-operators-ml.proto3.pb.cc
Removing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-operators-ml.proto3.pb.h
generating C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx_operators_pb.py
Processing C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\src\onnx\onnx-data.in.proto
Writing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-data.proto
Writing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-data.proto3
Generate pb3 code using C:/Users/runneradmin/.conan2/p/proto8625022988b17/p/bin/protoc.exe
Removing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-data.proto3.pb.cc
Removing C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx-data.proto3.pb.h
generating C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx\onnx_data_pb.py
[  7%] Running C++ protocol buffer compiler on C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-operators-ml.proto
[  8%] Running C++ protocol buffer compiler on C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-data.proto
[  8%] Built target gen_onnx_operators_proto
[  8%] Built target gen_onnx_data_proto
[ 10%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.obj
[ 11%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-operators-ml.pb.cc.obj
[ 12%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-data.pb.cc.obj
[ 14%] Linking CXX static library libonnx_proto.a
[ 22%] Built target onnx_proto
[ 24%] Building CXX object CMakeFiles/onnx.dir/onnx/checker.cc.obj
[ 25%] Building CXX object CMakeFiles/onnx.dir/onnx/common/assertions.cc.obj
[ 27%] Building CXX object CMakeFiles/onnx.dir/onnx/common/interned_strings.cc.obj
[ 28%] Building CXX object CMakeFiles/onnx.dir/onnx/common/ir_pb_converter.cc.obj
[ 30%] Building CXX object CMakeFiles/onnx.dir/onnx/common/model_helpers.cc.obj
[ 31%] Building CXX object CMakeFiles/onnx.dir/onnx/common/path.cc.obj
[ 32%] Building CXX object CMakeFiles/onnx.dir/onnx/common/status.cc.obj
[ 34%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/attr_proto_util.cc.obj
[ 35%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/controlflow/defs.cc.obj
In file included from C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/src/onnx/onnx-data_pb.h:9,
                 from C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/src/onnx/checker.h:15,
                 from C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/src/onnx/common/path.h:20,
                 from C:\Users\runneradmin\.conan2\p\b\onnx8d4602591d608\b\src\onnx\common\path.cc:7:
C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/build/Release/onnx/onnx-data.pb.h:259:38: error: expected unqualified-id before '=' token
  259 |   static constexpr DataType OPTIONAL =
      |                                      ^
C:/Users/runneradmin/.conan2/p/b/onnx8d4602591d608/b/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:
@joda01 joda01 added the bug Something isn't working label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant