My Setup
I am trying to develop a Python 3 library as a C extension. I am on Windows 10, and I have Python 3.5.2 64 bit installed as my only Python distribution. I also have Visual Studio 2017 installed.
This library relies on glew and glfw. I believe I have installed the libraries properly, I've installed their headers in
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\
their .lib
files in
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
and their .dll
files in
C:\Windows\System32
My setup.py
file looks essentially like this:
module = Extension('my_library',
library_dirs=['C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib'],
libraries=['glew32', 'glfw3'],
sources=['my_library/c/my_library.c'])
setup(name="MyLibrary",
version="0.1",
description="My Python 3 Library",
ext_modules=[module])
The Problem
When I run python setup.py build
, I receive
MSVCRT.lib(chkstk.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1112
Okay, so I'm really not sure what that means, as my machine is 64 bit... but it is x86 architecture. But I assumed that meant that I was not targeting 64 bit, so I read online and found this answer, which says to run
set DISTUTILS_USE_SDK=1
set MSSdk=1
Using the "Visual Studio 2008 x64 Win64 Command Prompt", which I don't have. I tried the other command prompts, and they either give the same error, or they give
Compiling Desktop applications for the ARM platform is not supported.
When I try the setting DISTUTILS_USE_SDK
method on the regular command prompt, I receive the error
python\python35\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
The Question
I'm really not sure where to go from here. I just want to be able to link the glew/glfw. The module was originally compiling and working properly when the glew/glfw were not being included/linked.
Thank you for any advice