WojciechMula / pyahocorasick

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

Compile failure for Python 3.4 in Windows #54

Closed woakesd closed 6 years ago

woakesd commented 7 years ago

The attached compiler error seems to show that Py_ssize_t isn't defined. I don't get why though.

woakesd commented 7 years ago

running build running build_ext building 'ahocorasick' extension creating build creating build\temp.win-amd64-3.4 creating build\temp.win-amd64-3.4\Release c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DAHOCORASICK_UNICODE= -IC:\Python34\include -IC:\Python34\include /Tcpyahocorasick.c /Fobuild\temp.win-amd64-3.4\Release\pyahocorasick.obj pyahocorasick.c c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(36) : warning C4101: 'i' : unreferenced local variable c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(37) : warning C4101: 'bytes' : unreferenced local variable c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(128) : error C2143: syntax error : missing ';' before 'const' c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(129) : error C2143: syntax error : missing ';' before 'const' c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(131) : error C2065: 'min' : undeclared identifier c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(131) : error C2065: 'max' : undeclared identifier c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(132) : error C2065: 'min' : undeclared identifier c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\utils.c(132) : error C2065: 'max' : undeclared identifier c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\trienode.c(38) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\trie.c(128) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\Automaton.c(333) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\Automaton.c(542) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\Automaton.c(568) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\Automaton.c(950) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\Automaton.c(1036) : warning C4018: '<' : signed/unsigned mismatch c:\users\david woakes\documents\visual studio 2015\projects\pyahocorasick\Automaton_pickle.c(155) : warning C4018: '<' : signed/unsigned mismatch error: command 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.exe' failed with exit status 2

WojciechMula commented 7 years ago

It's something stranger than missing type, I believe that in Windows it's a kind of macro, or sth. I managed to fix it (in an ugly way), now the library builds for Py2, but not for Py3.

JB-MS commented 7 years ago

I have this problem under Windows 7, too. I have tested a lot of installing Windows tools and updates but so far i had no success.

Are there any new developments?

Cheers, Johannes

pombredanne commented 7 years ago

@WojciechMula you wrote:

now the library builds for Py2, but not for Py3.

IMHO you should tag and branch the current HEAD ass working on Py2 only ... and put Py2 on freeze. 2017 is going to be the year of massive Python 3 migration anyhow. So having the master support Py3 only again is quite fine by me. I am still on 2.7 atm, and I am fine with this. I will migrate to Py3 soon.

In a nutshell, supporting both 2 and 3 in one codebase is maddening! .... drop Py2!

pombredanne commented 7 years ago

@WojciechMula as an aside, I think that supporting anything before Python 3.5 is probably not worth it either. I would be as bold as saying that the minimum version of Python 3 should be 3.6.1 ;) or 3.6 at least. Anything before that has been more "experimental" to me ....

woakesd commented 7 years ago

ActiveState have only just released 3.5.3 for windows and I suspect a lot of people use that in commercial environments and probably have 3.4 installed (or worse still 2.7 which will probably linger for while I suspect).

Ubuntu 14.04 has python 3.4 as standard so I think you probably need to try and keep support for 3.4 and up.

WojciechMula commented 7 years ago

@pombredanne I wish I could do this, but there are people who still use py2. The better option would be split the codebase and have two separate repositories for py2 and py3. For me the code has become hard to maintain. It would be easier to backport/cherry-pick changes.

Speaking of specific versions of python, I would opt for 3.4 as the minimum.

JB-MS commented 7 years ago

Having a separate repository or branch (quicker solution?) sounds very good, indeed. At the moment we heavily rely on this Aho-Corasick implementation in our module Usrgal which is Python 3.4+ at the moment, so we would prefer this version as minimum requirements.

I am looking forward to hear from you.

Cheers, Johannes

WojciechMula commented 7 years ago

@JB-MS I'm going to create two new repositories, it will be easier to maintain. I think we can setup minimum Py3 version to 3.4, as you suggests.

JB-MS commented 7 years ago

@WojciechMula Thanks a lot for your efforts!

WojciechMula commented 6 years ago

After rethinking the issue, I decided to keep a single repository. :)

pombredanne commented 6 years ago

@WojciechMula that works nicely. Restating from earlier, any serious usage of Python 3 before 3.5 or even 3.6.1 is not worth supporting IMHO. AS for Python2 I am quite happy with the current support and this can go in a maintenance branch alright. By the end of 2018 or earlier, all my stuff will be migrated to Python 3.6.1 or later ;)

pombredanne commented 6 years ago

@woakesd @JB-MS are you really serious about being stuck in the confidential Python 3.4'ish land?

JB-MS commented 6 years ago

@pombredanne I have tested it now with Python 3.6.3 under Win 7 (additionally installed: Microsoft Visual C++ Build Tools, http://landinghub.visualstudio.com/visual-cpp-build-tools) and now it works fine. Closing the issue would be fine by me.

pombredanne commented 6 years ago

@JB-MS That's really nice of you! @woakesd I am closing this issue if you do not mind.... Please to reopen if you feel strongly about it. Supporting Python 3.4 is really a hard thing that is not worth it if the latest Python 3 works nicely.