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: unknown type name '_Frees_ptr_opt_' #1175

Closed
ArekMC opened this issue Jun 6, 2019 · 10 comments
Closed

error: unknown type name '_Frees_ptr_opt_' #1175

ArekMC opened this issue Jun 6, 2019 · 10 comments
Assignees
Labels
contributions welcome lower priority issues for the core ORT teams feature request request for unsupported feature or enhancement

Comments

@ArekMC
Copy link

ArekMC commented Jun 6, 2019

Describe the bug
I am trying to include onnxruntime into a c-application for win 10. For that I use the precompiled binaries here. Compiling of my program stops with error: unknown type name '_Frees_ptr_opt_'. Google can't help.
I added my gcc command below. Did I miss sth? Thanks in advance.

In file included from onnxdemo.c:2:
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:142:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(Env);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:143:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(Status);  // nullptr for Status* indicates success
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:144:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(Provider);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:145:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(AllocatorInfo);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:146:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(Session);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:147:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(Value);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:148:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(ValueList);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:149:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(RunOptions);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:150:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(TypeInfo);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:151:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(TensorTypeAndShapeInfo);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:152:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(SessionOptions);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:153:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(Callback);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:139:32: error: unknown type name '_Frees_ptr_opt_'
   ORT_API(void, OrtRelease##X, _Frees_ptr_opt_ Ort##X* input);
                                ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
                                            ^~~~~~~~~~~
onnxruntime_c_api.h:154:1: note: in expansion of macro 'ORT_RUNTIME_CLASS'
 ORT_RUNTIME_CLASS(CustomOpDomain);
 ^~~~~~~~~~~~~~~~~
onnxruntime_c_api.h:357:31: error: unknown type name '_Frees_ptr_opt_'
 ORT_API(void, OrtRunCallback, _Frees_ptr_opt_ OrtCallback* f);
                               ^~~~~~~~~~~~~~~
onnxruntime_c_api.h:127:44: note: in definition of macro 'ORT_API'
   ORT_EXPORT RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION

System information

To Reproduce
gcc -L"./" -lonnxruntime -o onnxdemo onnxdemo.c

onnxdemo.c

#include "onnxruntime_c_api.h"
#include <stdio.h>

int main(void)    
{
  printf("Hello, world!\n");
  return 0;
}
@pranavsharma
Copy link
Contributor

pranavsharma commented Jun 6, 2019

What's your gcc version? Officially we only support gcc (5.4) on Ubuntu, vs on Windows and apple clang on Mac.

@pranavsharma pranavsharma self-assigned this Jun 6, 2019
@snnn
Copy link
Member

snnn commented Jun 6, 2019

Oh, I get it.

We do never tested the code with MinGW, and we don't have any plan in the near future to support it.
We do support WSL.

I can send a PR to fix this, would you help me test it? (you need to compile onnxruntime from source code).

@ArcticTee
Copy link

I got this error as well.

If you include #define _Frees_ptr_opt_ in the main.cpp file you can compile it but you can not run anything.

@snnn
Copy link
Member

snnn commented Jun 7, 2019

I tried to fix it, but it's not easy. older version gcc (like 5.4) doesn't support calling conversion for lambda expressions. It's a problem for 32 bits program and gcc.

@snnn snnn added contributions welcome lower priority issues for the core ORT teams feature request request for unsupported feature or enhancement and removed bug labels Jun 7, 2019
@snnn
Copy link
Member

snnn commented Jun 7, 2019

Hi @faxu, this is a new feature request. @ArekMC is asking for MinGW and gcc support on Windows for the C API. Currently, we are assume the only compiler we support on Windows is the Visual Studio 2017. see: https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#supported-dev-environments .
And MinGW was never in my mind.

@snnn snnn added the C/C++ API label Jun 7, 2019
@pranavsharma
Copy link
Contributor

We've no plans to provide official support for MinGW at this time. We do encourage contributions, however, please note that since we won't be supporting it officially, it is subject to break in the future.

@pranavsharma
Copy link
Contributor

Closing this as per previous comment.

@Gitlixiangdong
Copy link

Did you use mingw to compile successfully?

@MyraBaba
Copy link

@pranavsharma

Hi Is there any support for MinGW for windows ? any hope ?

O just we should stop dreaming ?

@Baxulio
Copy link

Baxulio commented Mar 22, 2022

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')

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome lower priority issues for the core ORT teams feature request request for unsupported feature or enhancement
Projects
None yet
Development

No branches or pull requests

8 participants