Skip to content
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

Compilation fails with MSVC 2015, Python 3.5 #688

Closed
msarahan opened this issue Sep 25, 2015 · 6 comments
Closed

Compilation fails with MSVC 2015, Python 3.5 #688

msarahan opened this issue Sep 25, 2015 · 6 comments

Comments

@msarahan
Copy link
Contributor

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPSUTIL_VERSION=321 -D_WIN32_WINNT=0x01000 -D_AVAIL_WINVER_=0x01000 -D_CRT_SECURE_NO_WARNINGS -DPSAPI_VERSION=1 -IC:\Users\builder\MC_Main\envs\py35\include -IC:\Users\builder\MC_Main\envs\py35\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.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" "-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.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcpsutil/_psutil_windows.c /Fobuild\temp.win-amd64-3.5\Release\psutil/_psutil_windows.obj
_psutil_windows.c
c:\users\builder\mc_main\conda-bld\work\psutil-3.2.1\psutil\arch\windows\ntextapi.h(212): error C2365: 'ProcessBreakOnTermination': redefinition; previous definition was 'enumerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um\winternl.h(308): note: see declaration of 'ProcessBreakOnTermination'
c:\users\builder\mc_main\conda-bld\work\psutil-3.2.1\psutil\arch\windows\ntextapi.h(212): error C2086: '_PROCESSINFOCLASS2 ProcessBreakOnTermination': redefinition
c:\users\builder\mc_main\conda-bld\work\psutil-3.2.1\psutil\arch\windows\ntextapi.h(212): note: see declaration of 'ProcessBreakOnTermination'
c:\users\builder\mc_main\conda-bld\work\psutil-3.2.1\psutil\arch/windows/inet_ntop.h(10): warning C4028: formal parameter 2 different from declaration
psutil/_psutil_windows.c(1389): warning C4267: '=': conversion from 'size_t' to 'ULONG', possible loss of data
psutil/_psutil_windows.c(1390): warning C4267: '=': conversion from 'size_t' to 'ULONG', possible loss of data
psutil/_psutil_windows.c(1963): warning C4312: 'type cast': conversion from 'int' to 'PVOID' of greater size
psutil/_psutil_windows.c(2732): warning C4311: 'type cast': pointer truncation from 'PVOID' to 'unsigned long'
psutil/_psutil_windows.c(3065): warning C4133: 'function': incompatible types - from 'PyObject *' to 'const char *'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2

Will post back if I figure out a patch.

@giampaolo
Copy link
Owner

Note: I cannot install Python 3.5 on Windows. I've searched a bit and it seems I'm not the only one.

@msarahan
Copy link
Contributor Author

Wow! Maybe I can help with that? I have bundled it for Continuum's Anaconda distribution, and have tested it on win 7 and 8. What platform are you on?

If you use conda, you can do:

conda create -n py35 python=3.5

@msarahan
Copy link
Contributor Author

Update: MSVC2015 forces compilation with the C++11 standard. Part of this standard is scoped enumerators: https://msdn.microsoft.com/en-us/library/vstudio/2dzy4k6e(v=vs.110).aspx

One solution is to add the enum definitions to a namespace. I'll see if there's a way to change compiler settings instead of changing code.

@msarahan
Copy link
Contributor Author

#690 should address this.

@maxbelanger
Copy link
Contributor

This patch didn't do the trick for us on Visual Studio 2013 + Windows 8.1 SDK (seeing the same error), so we have an alternative solution for your consideration (#936).

@giampaolo
Copy link
Owner

I just merged #936.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants