theshadow124 theshadow124 - 1 month ago 10
Python Question

Building Cython-HIDapi Python 2.7

I have been having many issues building Cython in my virtual machine in Windows. I didn't have any problems in OS X and it's really starting to frustrate me...

>>setup.py clean install


running clean
removing 'build\temp.win-amd64-2.7' (and everything under it)
removing 'build'
running install
running build
running build_ext
skipping 'hid.c' Cython extension (up-to-date)
building 'hid' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchid.c /Fobuild\temp.win-amd64-2.7\Release\hid.obj
hid.c
c:\python27\include\pymath.h(22) : warning C4273: 'round' : inconsistent dll linkage
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(516) : see previous definition of 'round'
hid.c(801) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchid-libus
b.c /Fobuild\temp.win-amd64-2.7\Release\hid-libusb.obj
hid-libusb.c
hid-libusb.c(52) : fatal error C1083: Cannot open include file: 'iconv.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe"' failed with exit status 2


I can't find any header named 'iconv.h' on my computer. If this isn't included in VC++ 2013, how can I get it to work?

After using
>>setup-windows.py clean install
:

running clean
removing 'build\temp.win-amd64-2.7' (and everything under it)
removing 'build'
running install
running build
running build_ext
skipping 'hid.c' Cython extension (up-to-date)
building 'hid' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nolog
o /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchid.c /Fob
uild\temp.win-amd64-2.7\Release\hid.obj
hid.c
hid.c(801) : warning C4267: '=' : conversion from 'size_t' to 'int', possible lo
ss of data
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nolog
o /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchid-window
s.c /Fobuild\temp.win-amd64-2.7\Release\hid-windows.obj
hid-windows.c
hid-windows.c(205) : error C2275: 'GUID' : illegal use of this type as an expres
sion
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\guiddef.h(27) : s
ee declaration of 'GUID'
hid-windows.c(205) : error C2146: syntax error : missing ';' before identifier '
InterfaceClassGuid'
hid-windows.c(205) : error C2065: 'InterfaceClassGuid' : undeclared identifier
hid-windows.c(205) : error C2059: syntax error : '{'
hid-windows.c(206) : error C2275: 'SP_DEVINFO_DATA' : illegal use of this type a
s an expression
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(708) :
see declaration of 'SP_DEVINFO_DATA'
hid-windows.c(206) : error C2146: syntax error : missing ';' before identifier '
devinfo_data'
hid-windows.c(206) : error C2065: 'devinfo_data' : undeclared identifier
hid-windows.c(207) : error C2275: 'SP_DEVICE_INTERFACE_DATA' : illegal use of th
is type as an expression
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(720) :
see declaration of 'SP_DEVICE_INTERFACE_DATA'
hid-windows.c(207) : error C2146: syntax error : missing ';' before identifier '
device_interface_data'
hid-windows.c(207) : error C2065: 'device_interface_data' : undeclared identifie
r
hid-windows.c(208) : error C2275: 'SP_DEVICE_INTERFACE_DETAIL_DATA_A' : illegal
use of this type as an expression
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(742) :
see declaration of 'SP_DEVICE_INTERFACE_DETAIL_DATA_A'
hid-windows.c(208) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(209) : error C2275: 'HDEVINFO' : illegal use of this type as an ex
pression
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(697) :
see declaration of 'HDEVINFO'
hid-windows.c(209) : error C2146: syntax error : missing ';' before identifier '
device_info_set'
hid-windows.c(209) : error C2065: 'device_info_set' : undeclared identifier
hid-windows.c(209) : warning C4047: '=' : 'int' differs in levels of indirection
from 'HANDLE'
hid-windows.c(212) : error C2065: 'devinfo_data' : undeclared identifier
hid-windows.c(212) : error C2224: left of '.cbSize' must have struct/union type
hid-windows.c(213) : error C2065: 'device_interface_data' : undeclared identifie
r
hid-windows.c(213) : error C2224: left of '.cbSize' must have struct/union type
hid-windows.c(217) : error C2065: 'device_info_set' : undeclared identifier
hid-windows.c(217) : error C2065: 'InterfaceClassGuid' : undeclared identifier
hid-windows.c(217) : warning C4133: 'function' : incompatible types - from 'int
*' to 'const GUID *'
hid-windows.c(217) : warning C4047: '=' : 'int' differs in levels of indirection
from 'HDEVINFO'
hid-windows.c(220) : error C2143: syntax error : missing ';' before 'type'
hid-windows.c(225) : error C2065: 'device_info_set' : undeclared identifier
hid-windows.c(225) : warning C4022: 'SetupDiEnumDeviceInterfaces' : pointer mism
atch for actual parameter 1
hid-windows.c(227) : error C2065: 'InterfaceClassGuid' : undeclared identifier
hid-windows.c(227) : warning C4133: 'function' : incompatible types - from 'int
*' to 'const GUID *'
hid-windows.c(228) : error C2065: 'device_index' : undeclared identifier
hid-windows.c(229) : error C2065: 'device_interface_data' : undeclared identifie
r
hid-windows.c(229) : warning C4133: 'function' : incompatible types - from 'int
*' to 'PSP_DEVICE_INTERFACE_DATA'
hid-windows.c(240) : error C2065: 'device_info_set' : undeclared identifier
hid-windows.c(240) : warning C4022: 'SetupDiGetDeviceInterfaceDetailA' : pointer
mismatch for actual parameter 1
hid-windows.c(241) : error C2065: 'device_interface_data' : undeclared identifie
r
hid-windows.c(241) : warning C4133: 'function' : incompatible types - from 'int
*' to 'PSP_DEVICE_INTERFACE_DATA'
hid-windows.c(248) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(248) : warning C4047: '=' : 'int' differs in levels of indirection
from 'SP_DEVICE_INTERFACE_DETAIL_DATA_A *'
hid-windows.c(249) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(249) : error C2223: left of '->cbSize' must point to struct/union
hid-windows.c(254) : error C2065: 'device_info_set' : undeclared identifier
hid-windows.c(254) : warning C4022: 'SetupDiGetDeviceInterfaceDetailA' : pointer
mismatch for actual parameter 1
hid-windows.c(255) : error C2065: 'device_interface_data' : undeclared identifie
r
hid-windows.c(255) : warning C4133: 'function' : incompatible types - from 'int
*' to 'PSP_DEVICE_INTERFACE_DATA'
hid-windows.c(256) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(256) : warning C4047: 'function' : 'PSP_DEVICE_INTERFACE_DETAIL_DA
TA_A' differs in levels of indirection from 'int'
hid-windows.c(256) : warning C4024: 'SetupDiGetDeviceInterfaceDetailA' : differe
nt types for formal and actual parameter 3
hid-windows.c(270) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(270) : error C2223: left of '->DevicePath' must point to struct/un
ion
hid-windows.c(271) : warning C4047: 'function' : 'LPCSTR' differs in levels of i
ndirection from 'unsigned long'
hid-windows.c(271) : warning C4024: 'CreateFileA' : different types for formal a
nd actual parameter 1
hid-windows.c(273) : warning C4047: 'function' : 'DWORD' differs in levels of in
direction from 'void *'
hid-windows.c(273) : warning C4024: 'CreateFileA' : different types for formal a
nd actual parameter 3
hid-windows.c(274) : warning C4047: 'function' : 'LPSECURITY_ATTRIBUTES' differs
in levels of indirection from 'int'
hid-windows.c(274) : warning C4024: 'CreateFileA' : different types for formal a
nd actual parameter 4
hid-windows.c(276) : error C2198: 'CreateFileA' : too few arguments for call
hid-windows.c(287) : error C2275: 'HIDD_ATTRIBUTES' : illegal use of this type a
s an expression
hid-windows.c(79) : see declaration of 'HIDD_ATTRIBUTES'
hid-windows.c(287) : error C2146: syntax error : missing ';' before identifier '
attrib'
hid-windows.c(287) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(288) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(288) : error C2224: left of '.Size' must have struct/union type
hid-windows.c(289) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(289) : warning C4133: 'function' : incompatible types - from 'int
*' to 'PHIDD_ATTRIBUTES'
hid-windows.c(295) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(295) : error C2224: left of '.VendorID' must have struct/union typ
e
hid-windows.c(295) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(295) : error C2224: left of '.ProductID' must have struct/union ty
pe
hid-windows.c(331) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(331) : error C2223: left of '->DevicePath' must point to struct/un
ion
hid-windows.c(363) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(363) : error C2224: left of '.VendorID' must have struct/union typ
e
hid-windows.c(364) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(364) : error C2224: left of '.ProductID' must have struct/union ty
pe
hid-windows.c(367) : error C2065: 'attrib' : undeclared identifier
hid-windows.c(367) : error C2224: left of '.VersionNumber' must have struct/unio
n type
hid-windows.c(377) : error C2065: 'device_interface_detail_data' : undeclared id
entifier
hid-windows.c(377) : warning C4022: 'free' : pointer mismatch for actual paramet
er 1
hid-windows.c(379) : error C2065: 'device_index' : undeclared identifier
hid-windows.c(384) : error C2065: 'device_info_set' : undeclared identifier
hid-windows.c(384) : warning C4022: 'SetupDiDestroyDeviceInfoList' : pointer mis
match for actual parameter 1
hid-windows.c(505) : warning C4267: 'function' : conversion from 'size_t' to 'DW
ORD', possible loss of data
hid-windows.c(536) : error C2275: 'OVERLAPPED' : illegal use of this type as an
expression
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\winbase.h(250) :
see declaration of 'OVERLAPPED'
hid-windows.c(536) : error C2146: syntax error : missing ';' before identifier '
ol'
hid-windows.c(536) : error C2065: 'ol' : undeclared identifier
hid-windows.c(537) : error C2065: 'ol' : undeclared identifier
hid-windows.c(537) : error C2065: 'ol' : undeclared identifier
hid-windows.c(538) : error C2065: 'ol' : undeclared identifier
hid-windows.c(538) : error C2224: left of '.hEvent' must have struct/union type
hid-windows.c(544) : warning C4267: 'function' : conversion from 'size_t' to 'DW
ORD', possible loss of data
hid-windows.c(544) : error C2065: 'ol' : undeclared identifier
hid-windows.c(544) : warning C4133: 'function' : incompatible types - from 'int
*' to 'LPOVERLAPPED'
hid-windows.c(571) : error C2065: 'ol' : undeclared identifier
hid-windows.c(571) : warning C4133: 'function' : incompatible types - from 'int
*' to 'LPOVERLAPPED'
hid-windows.c(603) : warning C4267: 'function' : conversion from 'size_t' to 'UL
ONG', possible loss of data
hid-windows.c(609) : warning C4267: 'return' : conversion from 'size_t' to 'int'
, possible loss of data
hid-windows.c(631) : warning C4267: 'function' : conversion from 'size_t' to 'DW
ORD', possible loss of data
hid-windows.c(632) : warning C4267: 'function' : conversion from 'size_t' to 'DW
ORD', possible loss of data
hid-windows.c(668) : warning C4267: 'function' : conversion from 'size_t' to 'UL
ONG', possible loss of data
hid-windows.c(681) : warning C4267: 'function' : conversion from 'size_t' to 'UL
ONG', possible loss of data
hid-windows.c(694) : warning C4267: 'function' : conversion from 'size_t' to 'UL
ONG', possible loss of data
hid-windows.c(707) : warning C4267: 'function' : conversion from 'size_t' to 'UL
ONG', possible loss of data
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64
\cl.exe"' failed with exit status 2

Answer

The project contains separated setup-windows.py setup script.

Use that script instead of setup.py.

python setup-windows.py install