r9y9/pyopenjtalk

MSVC compiler doesn't support C++11,which cause ERROR: Failed building wheel for pyopenjtalk

Opened this issue · 3 comments

I meet problem when building wheels for pyopenjtalk, followings are some errors during the building of openjtalk:

here is the branch of openjtalk I use https://github.com/r9y9/open_jtalk/tree/ce06fc565eecbf57a698dacde935f2060a60d627

...
lib\open_jtalk\src\mecab/src\dictionary.cpp(68): error C2143: 语法错误: 缺少“,”(在“<”的前面)
lib\open_jtalk\src\mecab/src\dictionary.cpp(68): error C2504: “binary_function”: 未定义基类
...

It seems the problem of C++ standard of the compiler, because binary_function has been removed in C++ 14. So I attempt to modify the compiler standard, then an amusing thing took place:

image

2022 MSVC doesn't support C++11! The tool chain of MSVC was downloaded just yesterday. So I wonder how to tell the setup.py to use gcc.exe instead of cl.exe. Thx :D bro.

I'm not very familiar with C/C++, but I found some information that might be relevant.

Microsoft's C++ Standard Library - Changelog

Refactored a central internal header so that the rest of the STL includes fewer headers and provides less machinery beyond what's required. #3623 #3654
Need to include <functional> for unary_function and binary_function.
Note that unary_function and binary_function were deprecated in C++11 and removed in C++17, so it's best to stop using them completely.

r9y9 commented

According to GitHub actions https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013, windows CI runs with Visual Studio Enterprise 2022 (version: 17.6.33829.357).

Current runner version: '2.308.0'
Operating System
  Microsoft Windows Server [2](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:2)022
  10.0.20[3](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:3)[4](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:4)8
  Datacenter
Runner Image
  Image: windows-2022
  Version: 20230[8](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:9)04.1.0
  Included Software: https://github.com/actions/runner-images/blob/win22/20230804.1/images/win/Windows2022-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230804.1

https://github.com/actions/runner-images/blob/win22/20230804.1/images/win/Windows2022-Readme.md

I wonder if just adding /std:c11 option to MSVC should be OK but I don't have a windows machine and cannot test.

According to GitHub actions https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013, windows CI runs with Visual Studio Enterprise 2022 (version: 17.6.33829.357).

Current runner version: '2.308.0'
Operating System
  Microsoft Windows Server [2](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:2)022
  10.0.20[3](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:3)[4](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:4)8
  Datacenter
Runner Image
  Image: windows-2022
  Version: 20230[8](https://github.com/r9y9/pyopenjtalk/actions/runs/5934952653/job/16092609013#step:1:9)04.1.0
  Included Software: https://github.com/actions/runner-images/blob/win22/20230804.1/images/win/Windows2022-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230804.1

https://github.com/actions/runner-images/blob/win22/20230804.1/images/win/Windows2022-Readme.md

I wonder if just adding /std:c11 option to MSVC should be OK but I don't have a windows machine and cannot test.

Just tested on windows, running "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx86\x64\cl.exe" /std:c11 results in:

Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32822 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line error D8003 : missing source filename