adamlwgriffiths / cyglfw3

Cython bindings for GLFW3
Other
20 stars 6 forks source link

Trouble building on Windows #22

Open ngoldbaum opened 8 years ago

ngoldbaum commented 8 years ago

When I try to build under python2.7 on Windows 10, I get the following error:

$ python setup.py build_ext -i
running build_ext
building 'cyglfw3.glfw3' extension
C:\Users\dxl\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\dxl\Miniconda2\include -IC:\Users\dxl\Miniconda2\PC /Tccyglfw3/glfw3.c /Fobuild\temp.win-amd64-2.7\Release\cyglfw3/glfw3.obj -IC:/Users/dxl/glfw-3.2/include
glfw3.c
C:/Users/dxl/glfw-3.2/include\GLFW/glfw3.h(123) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\\Users\\dxl\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

I have the Microsoft visual C++ compiler for Python 2.7 installed and have GLFW_ROOT set to point to the glfw binaries from glfw.org.

ngoldbaum commented 8 years ago

Hmm, maybe this is an upstream glfw issue? If I add stdint.h from http://snipplr.com/view.php?codeview&id=18199 to glfw's include directory I can compile.

adamlwgriffiths commented 8 years ago

I'd say there's an include path issue. stdint.h should be part of the MSVC redistributable package and included in MSVC 2010(?). https://stackoverflow.com/questions/13642827/cstdint-vs-stdint-h Although it was apparently missing from MSVC 2003 -> MSVC ? https://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio

ngoldbaum commented 8 years ago

Right, visual c++ for python 2.7 is based on MSVC 2008, so the release before they started bundling stdint.h. Unfortunately this is the compiler that Microsoft and the upstream python devs recommend for Python 2.7 C extensions on Windows, since that's the compiler that was used to build Python originally.

adamlwgriffiths commented 8 years ago

Hmm, it's a bit grey as to whether it's an external tool problem that requires a section in the README, or some sort of logic in the setup.py. Is there a "proper" method to install this? Thoughts?

ngoldbaum commented 8 years ago

I think generally projects include a windows-specific version of stdint.h. I think this would need to happen in glfw proper. Also, looking at glfw3.h, it seems stdint.h is only included for vulkan support (according to the comment here: https://github.com/glfw/glfw/blob/master/include/GLFW/glfw3.h#L124) which indicates it was added recently, so maybe they didn't realize that this caused a regression for people on older windows versions or compiling stuff that depends on older versions of MSVC.