8000 BLD: fix build issues with MSVC10 on Windows. Closes gh-4245. · rgommers/numpy@fa0ec11 · GitHub
[go: up one dir, main page]

Skip to content

Commit fa0ec11

Browse files
author
Ralf Gommers
committed
BLD: fix build issues with MSVC10 on Windows. Closes numpygh-4245.
Note that there are a few similar patches posted to numpygh-4101 and numpygh-4245. Those were all patches to msvc9compiler in Python distutils. Monkeypatching ``MSVCCompiler.link`` is less easy than this change to ``config._check_compiler``; effect should be the same. Also updates the error message shown when initializing MSVC fails. [ci skip]
1 parent fcce027 commit fa0ec11

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

numpy/distutils/command/config.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,28 @@ def _check_compiler (self):
5959
e = get_exception()
6060
msg = """\
6161
Could not initialize compiler instance: do you have Visual Studio
62-
installed ? If you are trying to build with mingw, please use python setup.py
63-
build -c mingw32 instead ). If you have Visual Studio installed, check it is
64-
correctly installed, and the right version (VS 2008 for python 2.6, VS 2003 for
65-
2.5, etc...). Original exception was: %s, and the Compiler
66-
class was %s
62+
installed? If you are trying to build with MinGW, please use "python setup.py
63+
build -c mingw32" instead. If you have Visual Studio installed, check it is
64+
correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2,
65+
VS 2010 for >= 3.3).
66+
67+
Original exception was: %s, and the Compiler class was %s
6768
============================================================================""" \
6869
% (e, self.compiler.__class__.__name__)
6970
print ("""\
7071
============================================================================""")
7172
raise distutils.errors.DistutilsPlatformError(msg)
7273

74+
# After MSVC is initialized, add an explicit /MANIFEST to linker
75+
# flags. See issues gh-4245 and gh-4101 for details. Also
76+
# relevant are issues 4431 and 16296 on the Python bug tracker.
77+
from distutils import msvc9compiler
78+
if msvc9compiler.get_build_version() >= 10:
79+
for ldflags in [self.compiler.ldflags_shared,
80+
self.compiler.ldflags_shared_debug]:
81+
if '/MANIFEST' not in ldflags:
82+
ldflags.append('/MANIFEST')
83+
7384
if not isinstance(self.fcompiler, FCompiler):
7485
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
7586
dry_run=self.dry_run, force=1,

0 commit comments

Comments
 (0)
0