Compiling native extensions with Visual Studio 2012?

wcdolphin at gmail.com wcdolphin at gmail.com
Wed Feb 6 16:13:39 CET 2013


On Saturday, January 12, 2013 2:45:38 AM UTC-5, Alec Taylor wrote:
> There have been various threads for MSVC 2010[1][2], but the most
> 
> recent thing I found for MSVC 2012 was [3]… from 6 months ago.
> 
> 
> 
> Basically I want to be able to compile bcrypt—and yes I should be
> 
> using Keccak—x64 binaries on Windows x64.
> 
> 
> 
> There are other packages also which I will benefit from, namely I
> 
> won't need to use the unofficial setup files and will finally be able
> 
> to use virtualenv.
> 
> 
> 
> So anyway, can I get an update on the status of MSVC 2010 and MSVC
> 
> 2012 compatibility?
> 
> 
> 
> Thanks,
> 
> 
> 
> Alec Taylor
> 
> 
> 
> [1] http://bugs.python.org/issue13210
> 
> [2] http://webcache.googleusercontent.com/search?q=cache:xPaU9mlCBNEJ:wiki.python.org/moin/VS2010+&cd=1&hl=en&ct=clnk
> 
> [3] https://groups.google.com/d/topic/dev-python/W1RpFhaOIGk

Besides the deep technicality of potential conflicts, two changes will allow you to compile your C extension. msvc9compiler.py is written only looking for VS2010, and even if you have vs2010 installed, it will still fail on Windows 7, Windows 8 with silly manifest errors.

The fix is simple:
In: Python27/Lib/distutils/msvc9compiler.py,
line#648 in definition of "link", before the call to "ld_args.append('/MANIFESTFILE:' + temp_manifest)",insert:
    ld_args.append('/MANIFEST')

line#178 in the definition of "get_build_version", insert:
    return 11.0




More information about the Python-list mailing list