microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.61k stars 2.92k forks source link

MinGW support (MSYS2) #10976

Open Baxulio opened 2 years ago

Baxulio commented 2 years ago

It's clear that It's hard to use MinGW itself. One needs to get all dependant libraries of MinGW version also and this is hard work. But there is an environment called MSYS2. Its Archlinux based package (pacman) manager has all required libraries.

Theoretically by running Linux script it must be built successfully, but in practice when I run the following script:

$ ./build.sh --config=MinSizeRel --build_shared_lib --minimal_build --disable_ml_ops --disable_exceptions --skip_tests --cmake_generator "MSYS Makefiles"

it outputs:

2022-03-23 00:21:03,096 tools_python_utils [INFO] - flatbuffers module is not installed. parse_config will not be available
2022-03-23 00:21:03,096 build [DEBUG] - Command line arguments:
  --build_dir C:/msys64/home/bakhmanyor.nurnazar/onnxruntime/build/Linux --config=MinSizeRel --build_shared_lib --minimal_build --disable_ml_ops --disable_exceptions --skip_tests --cmake_generator 'MSYS Makefiles'
usage:
        Default behavior is --update --build --test for native architecture builds.
        Default behavior is --update --build for cross-compiled builds.

        The Update phase will update git submodules, and run cmake to generate makefiles.
        The Build phase will build all projects.
        The Test phase will run all unit tests, and optionally the ONNX tests.

        Use the individual flags to only run the specified stages.

build.py: error: argument --cmake_generator: invalid choice: 'MSYS Makefiles' (choose from 'Visual Studio 15 2017', 'Visual Studio 16 2019', 'Visual Studio 17 2022', 'Ninja')

Please, can anyone help with this? I think it's possible to compile under MinGW without much effort by using MSYS2.

yuslepukhin commented 2 years ago

We do not build this configuration in house, and we do not run any CI builds for that. You are welcome to make this work and contribute it, but we would not verify that any future changes would not break it, as we already have many configs to build. In this case, it may be a build script option that needs to be supported. You should also familiarize yourself with the concept of the minimal build.