Jekub/Wapiti

Windows build

Opened this issue · 8 comments

Hi,
I want to build this package for windows.
I'm using visual studio 2013 but when I compile this package I got this erros

    bcd.c
    c:\users\m-r\appdata\local\temp\pip-build-rbuqyz8g\libwapiti\cwapiti\src\model.h(33) : fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\BIN\\cl.exe' failed with exit status 2

This answer said that 'sys/time.h' not supported on windows.
what can I do for fixing this problem?

Can you try a gcc compiler?

yes, I can.
which gcc compiler?
which options I must use?

<sys/times.h> is for POSIX system only.

On Windows you can try #include <time.h>

Or if the non standard functions are used have a look here

I don't have access to a win computer right now but maybe you can try installing gcc with Cygwin. This link might be of help.

@kermitt2 it is still failed after I changed to #include <time.h> with MSVC12 compiler.
It is appreciated if someone can make it compatible with MSVC compiler.

I did replace <sys/times.h> with #include <time.h> as @kermitt2 said. but I receive following error:

$ c:\python36\python.exe setup.py build
running build
running build_py
running egg_info
writing libwapiti.egg-info\PKG-INFO
writing dependency_links to libwapiti.egg-info\dependency_links.txt
writing requirements to libwapiti.egg-info\requires.txt
writing top-level names to libwapiti.egg-info\top_level.txt
reading manifest file 'libwapiti.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'libwapiti.egg-info\SOURCES.txt'
running build_ext
building 'libwapiti' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icwapiti/src -Ilibwapi
ti -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Progr
am Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0
\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\
shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /T
ccwapiti/src/bcd.c /Fobuild\temp.win32-3.6\Release\cwapiti/src/bcd.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
bcd.c
d:\MYNAME\libraries\libwapiti-0.2.1\cwapiti\src\options.h(95): error C2057: expected constant expression
d:\MYNAME\libraries\libwapiti-0.2.1\cwapiti\src\options.h(95): error C2466: cannot allocate an array of constant size 0
d:\MYNAME\libraries\libwapiti-0.2.1\cwapiti\src\model.h(92): error C2079: 'timer' uses undefined struct 'timeval'
d:\MYNAME\libraries\libwapiti-0.2.1\cwapiti\src\tools.h(38): warning C4005: 'min': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdlib.h(1283): note: see previous definition of 'min'
d:\MYNAME\libraries\libwapiti-0.2.1\cwapiti\src\tools.h(39): warning C4005: 'max': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdlib.h(1282): note: see previous definition of 'max'
cwapiti/src/bcd.c(118): error C2057: expected constant expression
cwapiti/src/bcd.c(118): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(118): error C2087: 'psi': missing subscript
cwapiti/src/bcd.c(119): error C2057: expected constant expression
cwapiti/src/bcd.c(119): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(119): error C2087: 'alpha': missing subscript
cwapiti/src/bcd.c(120): error C2057: expected constant expression
cwapiti/src/bcd.c(120): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(120): error C2087: 'beta': missing subscript
cwapiti/src/bcd.c(174): error C2057: expected constant expression
cwapiti/src/bcd.c(174): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(174): error C2087: 'psiuni': missing subscript
cwapiti/src/bcd.c(177): error C2057: expected constant expression
cwapiti/src/bcd.c(177): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(177): error C2087: 'psiidx': missing subscript
cwapiti/src/bcd.c(179): error C2057: expected constant expression
cwapiti/src/bcd.c(179): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(179): error C2087: 'alpha': missing subscript
cwapiti/src/bcd.c(180): error C2057: expected constant expression
cwapiti/src/bcd.c(180): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(180): error C2087: 'beta': missing subscript
cwapiti/src/bcd.c(212): error C2057: expected constant expression
cwapiti/src/bcd.c(212): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(212): error C2087: 'e': missing subscript
cwapiti/src/bcd.c(212): error C2133: 'e': unknown size
cwapiti/src/bcd.c(297): error C2057: expected constant expression
cwapiti/src/bcd.c(297): error C2466: cannot allocate an array of constant size 0
cwapiti/src/bcd.c(297): error C2133: 'cnt': unknown size
cwapiti/src/bcd.c(297): error C2133: 'lcl': unknown size
cwapiti/src/bcd.c(316): warning C4244: 'function': conversion from 'const uint64_t' to 'std::size_t', possible loss of data
cwapiti/src/bcd.c(317): warning C4244: 'function': conversion from 'const uint64_t' to 'std::size_t', possible loss of data
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

I have extracted the library in D:\MYNAME\Libraries\libwapiti-0.2.1
What can I do?

wmac commented

Any updates to this problem? Did anyone have success compiling Wapiti on windows?

hello @wmac ! Have you looked at @boumenot fork? https://github.com/boumenot/Wapiti
We're using it in GROBID and it runs well on Windows.