Skip to content

Problem with compiling for Python 3.5 under Windows 10 x64 #51

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

Closed
nchervyakov opened this issue Feb 28, 2017 · 10 comments · Fixed by #66
Closed

Problem with compiling for Python 3.5 under Windows 10 x64 #51

nchervyakov opened this issue Feb 28, 2017 · 10 comments · Fixed by #66

Comments

@nchervyakov
Copy link

nchervyakov commented Feb 28, 2017

I had a problem when tried to compile this library. The problem was the following:
Compiler said thet the following definitions from python-crfsuite/crfsuite/include/os.h conflict with such definitions from system <math.h>:
#define isfinite _finite
#define snprintf _snprintf

I changed them to the following:
#define my_isfinite _finite
#define my_snprintf _snprintf
And also fixed all places in the library where these definitions are used, and then everything compiled perfectly.

@jithurjacob
Copy link

@nchervyakov can you please share the compiled wheel file or changed source file so that it would be easy for all people facing the same issue?

@nchervyakov
Copy link
Author

@jithurjacob , I uploaded compiled library, changed source files from crfsuite, and a patch file with changes. I hope it will help.
python_crfsuite-0.9.1-py3.5-win-amd64.egg_with_patches.zip

@nchervyakov
Copy link
Author

I also prepared the wheel:
python_crfsuite-0.9.1-cp35-none-win_amd64.whl.zip

@jithurjacob
Copy link

@nchervyakov It is working for me. Thanks a lot

@rmax
Copy link
Contributor

rmax commented Mar 24, 2017

FYI, I have successfully build win-py3 packages in conda-forge: https://ci.appveyor.com/project/conda-forge/python-crfsuite-feedstock/build/1.0.13

With the minor patch of _MSC_VER < 1900. The PR conda-forge/python-crfsuite-feedstock#4 hopefully will get merged soon and windows packages will be available via conda.

Update: recipe has been merged and latest 0.9.1 release is now conda-installable for linux, osx and windows (except py27): conda install -c conda-forge python-crfsuite

@zvodd
Copy link

zvodd commented Mar 30, 2017

As a work around a manual build and install can be done (with git and Visual Studio 2014/2015 installed):

git clone "https://github.com/scrapinghub/python-crfsuite.git"
cd python-crfsuite
git clone "https://github.com/chokkan/crfsuite.git"
git clone "https://github.com/chokkan/liblbfgs"
python setup.py build
python setup.py install

Tested on Windows 10 Python 3.6 x64

@fgregg
Copy link
Contributor

fgregg commented May 23, 2017

@kmike, this is now a problem for the last two release of python. Thoughts on how we might address this?

@kmike
Copy link
Member

kmike commented May 23, 2017

@fgregg I think we should make a crfsuite fork with necessary fixes, and use it as a git submodule instead of the official crfsuite. I'm fine with switching to e.g. datamade's crfsuite fork :)

@fgregg
Copy link
Contributor

fgregg commented May 23, 2017

@kmike okay, sounds good!

@fgregg
Copy link
Contributor

fgregg commented Sep 1, 2017

Okay now we have a new problem:

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -Iinclude -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /EHsc /Tppycrfsuite/_pycrfsuite.cpp /Fobuild\temp.win32-3.5\Release\pycrfsuite/_pycrfsuite.obj
    _pycrfsuite.cpp
    crfsuite/win32\stdint.h(331): error C2371: 'uint32_t': redefinition; different basic types
    pycrfsuite/_pycrfsuite.cpp(402): note: see declaration of 'uint32_t'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

My suspicion is we don't want to to include win32/stdint.h at all for msvc 2015
https://ci.appveyor.com/project/kmike/python-crfsuite-mhi5h/build/1.0.40/job/5p568q2j12a1yt0o#L60

@kmike kmike closed this as completed in #66 Sep 3, 2017
kmike added a commit that referenced this issue Sep 3, 2017
updated crfsuite submodule to include msvc 2015 fix, closes #51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants