WojciechMula / pyahocorasick

Python module (C extension and plain python) implementing Aho-Corasick algorithm
BSD 3-Clause "New" or "Revised" License
914 stars 122 forks source link

Compilation fails with Python3.10 on Windows #151

Closed dgrunwald closed 2 years ago

dgrunwald commented 2 years ago

py -3.10 setup.py build fails with:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DAHOCORASICK_UNICODE= -IC:\Python310\include -IC:\Python310\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcpyahocorasick.c /Fobuild\temp.win-amd64-3.10\Release\pyahocorasick.obj
pyahocorasick.c
C:\temp\wheels\pyahocorasick\Automaton.h(59): error C2061: syntax error: identifier 'ssize_t'
C:\temp\wheels\pyahocorasick\Automaton.h(60): error C2061: syntax error: identifier 'words_count'
C:\temp\wheels\pyahocorasick\Automaton.h(60): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\Automaton.h(61): error C2061: syntax error: identifier 'longest_word'
C:\temp\wheels\pyahocorasick\Automaton.h(61): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\Automaton.h(62): error C2061: syntax error: identifier 'links_count'
C:\temp\wheels\pyahocorasick\Automaton.h(62): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\Automaton.h(63): error C2061: syntax error: identifier 'sizeof_node'
C:\temp\wheels\pyahocorasick\Automaton.h(63): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\Automaton.h(64): error C2061: syntax error: identifier 'total_size'
C:\temp\wheels\pyahocorasick\Automaton.h(64): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\Automaton.h(65): error C2059: syntax error: '}'
C:\temp\wheels\pyahocorasick\Automaton.h(80): error C2061: syntax error: identifier 'AutomatonStatistics'
C:\temp\wheels\pyahocorasick\Automaton.h(81): error C2059: syntax error: '}'
C:\temp\wheels\pyahocorasick\Automaton.h(87): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\Automaton.h(87): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\Automaton.h(88): error C2371: 'PyObject': redefinition; different basic types
C:\Python310\include\object.h(109): note: see declaration of 'PyObject'
C:\temp\wheels\pyahocorasick\Automaton.h(88): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\Automaton.h(89): error C2371: 'PyObject': redefinition; different basic types
C:\Python310\include\object.h(109): note: see declaration of 'PyObject'
C:\temp\wheels\pyahocorasick\Automaton.h(89): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\Automaton.h(90): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\Automaton.h(105): error C2061: syntax error: identifier 'automaton_len'
C:\temp\wheels\pyahocorasick\Automaton.h(105): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\Automaton.h(105): error C2059: syntax error: '<parameter-list>'
C:\temp\wheels\pyahocorasick\trie.h(20): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\trie.h(20): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\trie.h(20): warning C4142: 'uint32_t': benign redefinition of type
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\trie.h(20): error C2370: 'uint32_t': redefinition; different storage class
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\trie.h(20): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\trie.h(20): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\trie.h(20): error C2371: 'size_t': redefinition; different basic types
pyahocorasick.c: note: see declaration of 'size_t'
C:\temp\wheels\pyahocorasick\trie.h(20): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\trie.h(20): error C2146: syntax error: missing ';' before identifier 'wordlen'
C:\temp\wheels\pyahocorasick\trie.h(20): error C2371: 'bool': redefinition; different basic types
C:\temp\wheels\pyahocorasick\common.h(93): note: see declaration of 'bool'
C:\temp\wheels\pyahocorasick\trie.h(20): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\trie.h(24): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\trie.h(24): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\trie.h(24): warning C4142: 'uint32_t': benign redefinition of type
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\trie.h(24): error C2370: 'uint32_t': redefinition; different storage class
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\trie.h(24): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\trie.h(24): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\trie.h(24): error C2371: 'size_t': redefinition; different basic types
pyahocorasick.c: note: see declaration of 'size_t'
C:\temp\wheels\pyahocorasick\trie.h(24): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\trie.h(24): error C2146: syntax error: missing ';' before identifier 'wordlen'
C:\temp\wheels\pyahocorasick\trie.h(24): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(29): error C2061: syntax error: identifier 'Automaton'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(43): error C2059: syntax error: '}'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(48): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(48): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(49): error C2371: 'PyObject': redefinition; different basic types
C:\Python310\include\object.h(109): note: see declaration of 'PyObject'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(49): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(50): error C2059: syntax error: 'type'
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(53): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(21): error C2061: syntax error: identifier 'Automaton'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(23): error C2371: 'object': redefinition; different basic types
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(49): note: see declaration of 'object'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(29): error C2371: 'index': redefinition; different basic types
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(35): note: see declaration of 'index'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(30): error C2371: 'shift': redefinition; different basic types
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(36): note: see declaration of 'shift'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(31): error C2371: 'end': redefinition; different basic types
C:\temp\wheels\pyahocorasick\AutomatonSearchIter.h(37): note: see declaration of 'end'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(32): error C2059: syntax error: '}'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(37): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(37): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(38): error C2371: 'PyObject': redefinition; different basic types
C:\Python310\include\object.h(109): note: see declaration of 'PyObject'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(38): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(39): error C2059: syntax error: 'type'
C:\temp\wheels\pyahocorasick\AutomatonSearchIterLong.h(41): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(35): error C2061: syntax error: identifier 'Automaton'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(51): error C2059: syntax error: '}'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(57): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(57): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(58): warning C4142: 'uint32_t': benign redefinition of type
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(58): error C2370: 'uint32_t': redefinition; different storage class
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(58): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(58): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(59): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(59): error C2146: syntax error: missing ';' before identifier 'wordlen'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(61): error C2371: 'bool': redefinition; different basic types
C:\temp\wheels\pyahocorasick\common.h(93): note: see declaration of 'bool'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(61): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(61): error C2146: syntax error: missing ';' before identifier 'use_wildcard'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(61): error C2371: 'use_wildcard': redefinition; different basic types
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(48): note: see declaration of 'use_wildcard'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(62): warning C4142: 'uint32_t': benign redefinition of type
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(62): error C2370: 'uint32_t': redefinition; different storage class
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\stdint.h(24): note: see declaration of 'uint32_t'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(62): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(62): error C2146: syntax error: missing ';' before identifier 'wildcard'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(62): warning C4142: 'wildcard': benign redefinition of type
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(49): note: see declaration of 'wildcard'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(64): error C2370: 'PatternMatchType': redefinition; different storage class
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(29): note: see declaration of 'PatternMatchType'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(64): warning C4228: nonstandard extension used: qualifiers after comma in declarator list are ignored
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(64): error C2146: syntax error: missing ';' before identifier 'matchtype'
C:\temp\wheels\pyahocorasick\AutomatonItemsIter.h(65): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\utils.c(63): error C2146: syntax error: missing ')' before identifier 'size'
C:\temp\wheels\pyahocorasick\utils.c(63): error C2061: syntax error: identifier 'size'
C:\temp\wheels\pyahocorasick\utils.c(63): error C2059: syntax error: ';'
C:\temp\wheels\pyahocorasick\utils.c(63): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\utils.c(63): error C2449: found '{' at file scope (missing function header?)
C:\temp\wheels\pyahocorasick\utils.c(84): error C2059: syntax error: '}'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2081: 'ssize_t': name in formal parameter list illegal
C:\temp\wheels\pyahocorasick\utils.c(145): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2040: 'wordlen': 'int *' differs in levels of indirection from 'int'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2371: 'bool': redefinition; different basic types
C:\temp\wheels\pyahocorasick\common.h(93): note: see declaration of 'bool'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2143: syntax error: missing ';' before '*'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\utils.c(145): error C2054: expected '(' to follow 'is_copy'
C:\temp\wheels\pyahocorasick\utils.c(238): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\utils.c(238): error C2081: 'ssize_t': name in formal parameter list illegal
C:\temp\wheels\pyahocorasick\utils.c(238): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\utils.c(238): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\utils.c(238): error C2040: 'wordlen': 'int *' differs in levels of indirection from 'int'
C:\temp\wheels\pyahocorasick\utils.c(238): error C2054: expected '(' to follow 'wordlen'
C:\temp\wheels\pyahocorasick\utils.c(281): error C2143: syntax error: missing ')' before '*'
C:\temp\wheels\pyahocorasick\utils.c(281): error C2081: 'ssize_t': name in formal parameter list illegal
C:\temp\wheels\pyahocorasick\utils.c(281): error C2143: syntax error: missing '{' before '*'
C:\temp\wheels\pyahocorasick\utils.c(281): error C2059: syntax error: ')'
C:\temp\wheels\pyahocorasick\utils.c(281): error C2040: 'wordlen': 'int *' differs in levels of indirection from 'int'
C:\temp\wheels\pyahocorasick\utils.c(281): error C2054: expected '(' to follow 'wordlen'
C:\temp\wheels\pyahocorasick\utils.c(296): error C2146: syntax error: missing ')' before identifier 'min'
C:\temp\wheels\pyahocorasick\utils.c(296): fatal error C1003: error count exceeds 100; stopping compilation
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
WojciechMula commented 2 years ago

Thank you for fixing the issue.