Repository: pypa/setuptools

Issue:
Linking ext on Windows Python 3.5 do not quote libpath params
Hi.

I have a problem to link an extension from a project.

`LINK : fatal error LNK1181: cannot open input file 'Files.obj'`

It fail with python 3.5 and setuptools > 23 (all versions of branch 24 and 25 fail).

Here it fail

```
(venv) >pip list
cycler (0.10.0)
Cython (0.24.1)
fabio (0.4.0)
h5py (2.6.0)
lxml (3.6.0)
matplotlib (1.5.1)
numpy (1.11.1+mkl)
Pillow (3.3.0)
pip (8.1.2)
pyparsing (2.1.5)
python-dateutil (2.5.3)
pytz (2016.6.1)
scipy (0.17.1)
six (1.10.0)
wheel (0.29.0)

(venv) >pip install setuptools
Collecting setuptools
  Using cached setuptools-25.1.0-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-25.1.0

(venv) >python setup.py build
running build
running build_py
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from
distutils
building 'pyFAI.ext.splitPixelFullCSR' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /
nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls
\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic
:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\
VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INC
LUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:
\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files
 (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Wi
ndows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10
\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 1
4.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -
I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program F
iles (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86
)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kit
s\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\splitPixelFullCSR.c /Fobuild\temp.
win-amd64-3.5\Release\pyFAI\ext\splitPixelFullCSR.obj /openmp
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_
amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /n
ologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c
:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\
valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio
 14.0\VC\ATLMFC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10
.0.10586.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\
lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x
64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64 /LI
BPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64 /L
IBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64 /LIBPATH
:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Progr
am Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64 /EXPORT:PyInit_splitPixel
FullCSR build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixelFullCSR.obj /OUT:bu
ild\lib.win-amd64-3.5\pyFAI\ext\splitPixelFullCSR.cp35-win_amd64.pyd /IMPLIB:bui
ld\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixelFullCSR.cp35-win_amd64.lib
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_
amd64\link.exe
LINK : fatal error LNK1181: cannot open input file 'Files.obj'
error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_a
md64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTU
AC:NO /LIBPATH:c:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /L
IBPATH:C:\Users\valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:C:\Program Files (x86)\M
icrosoft Visual Studio 14.0\VC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Microso
ft Visual Studio 14.0\VC\ATLMFC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Window
s Kits\10\lib\10.0.10586.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits
\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\1
0.0.10586.0\um\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\
VC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATL
MFC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\u
crt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /
LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64 /EXPORT:P
yInit_splitPixelFullCSR build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixelFul
lCSR.obj /OUT:build\lib.win-amd64-3.5\pyFAI\ext\splitPixelFullCSR.cp35-win_amd64
.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixelFullCSR.cp35-w
in_amd64.lib  " failed with exit status 1181
```

Here it is ok

```
(venv) >pip install --upgrade setuptools==23
Collecting setuptools==23
  Using cached setuptools-23.0.0-py2.py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 25.1.0
    Uninstalling setuptools-25.1.0:
      Successfully uninstalled setuptools-25.1.0
Successfully installed setuptools-23.0.0

(venv) >python setup.py build
running build
running build_py
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from
distutils
building 'pyFAI.ext.splitPixelFullCSR' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /
nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls
\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic
:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\
VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INC
LUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:
\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files
 (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Wi
ndows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10
\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 1
4.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -
I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program F
iles (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86
)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kit
s\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\splitPixelFullCSR.c /Fobuild\temp.
win-amd64-3.5\Release\pyFAI\ext\splitPixelFullCSR.obj /openmp
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_
amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /n
ologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c
:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\
valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual
 Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\l
ib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK
\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.105
86.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LI
B\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\uc
rt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64"
 /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPO
RT:PyInit_splitPixelFullCSR build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixe
lFullCSR.obj /OUT:build\lib.win-amd64-3.5\pyFAI\ext\splitPixelFullCSR.cp35-win_a
md64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixelFullCSR.cp
35-win_amd64.lib
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_
amd64\link.exe
building 'pyFAI.ext.relabel' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /
nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls
\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic
:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\
VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INC
LUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:
\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files
 (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Wi
ndows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10
\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 1
4.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -
I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program F
iles (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86
)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kit
s\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\relabel.c /Fobuild\temp.win-amd64-
3.5\Release\pyFAI\ext\relabel.obj
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /n
ologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c
:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\
valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual
 Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\l
ib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK
\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.105
86.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LI
B\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\uc
rt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64"
 /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPO
RT:PyInit_relabel build\temp.win-amd64-3.5\Release\pyFAI\ext\relabel.obj /OUT:bu
ild\lib.win-amd64-3.5\pyFAI\ext\relabel.cp35-win_amd64.pyd /IMPLIB:build\temp.wi
n-amd64-3.5\Release\pyFAI\ext\relabel.cp35-win_amd64.lib
building 'pyFAI.ext.bilinear' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /
nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls
\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic
:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\
VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INC
LUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:
\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files
 (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Wi
ndows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10
\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 1
4.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -
I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program F
iles (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86
)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kit
s\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\bilinear.c /Fobuild\temp.win-amd64
-3.5\Release\pyFAI\ext\bilinear.obj /openmp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /n
ologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c
:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\
valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual
 Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\l
ib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK
\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.105
86.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LI
B\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC
\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\uc
rt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64"
 /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPO
RT:PyInit_bilinear build\temp.win-amd64-3.5\Release\pyFAI\ext\bilinear.obj /OUT:
build\lib.win-amd64-3.5\pyFAI\ext\bilinear.cp35-win_amd64.pyd /IMPLIB:build\temp
.win-amd64-3.5\Release\pyFAI\ext\bilinear.cp35-win_amd64.lib
CTRL-C
```

We can see that setuptools 25 do not quote /LIBPATH files.

Do you have any idea where this change of the behavior come from? I try another project containing extension with the same environment and it looks to work. Can it come from a bad setup of my project? My extensions come from Cython.

Thanks a lot.



Discussion:
My guess is that `setuptools==23.2.1` also works, which implicates [setuptools 24](http://setuptools.readthedocs.io/en/latest/history.html#v24-0-0), which did explicitly make a change to the way VC tools were handled.

@JGoutin Can you investigate?

I can confirm `setuptools==23.2.1` is working.

The MSCV patch return environment as a single string with unquoted paths separated by `;`.

`distutils._msvccompiler._get_vc_env` (The patched function for MSVC14) return environment in same format.

I checked by running:

```
import setuptools
# Patch
setuptools.msvc.EnvironmentInfo('x64', vc_min_ver=14.0).return_env()['libpath']
# Original Function
setuptools.msvc.unpatched['msvc14_get_vc_env']('x64')['libpath']
```

On my PC, there is no quote in all cases. You can try to run this also and report the result here.

So, it seem quotes come from another piece of code (From `distutils`?).

To be sure, maybe try to run your build after disabling the patch in `setuptools/msvc.py`, by example by adding a `return` line 60 of this file (at the start of the `patch_for_specialized_compiler` function). And see if the bug is always here.

Hi. I try to disable the patches, but nothing changed.
The behaviour is always the same.

I also check which patches are applied, and both MSVC9 and MSVC14 are used in normal condition.

I also try to use `distutils` instead of `setuptools`. And it is a surprise for me, but it is working well...

```
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'pyFAI.ext._geometry' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\pyFAI
creating build\temp.win-amd64-3.5\Release\pyFAI\ext
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\_geometry.c /Fobuild\temp.win-amd64-3.5\Release\pyFAI\ext\_geometry.obj /openmp
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit__geometry build\temp.win-amd64-3.5\Release\pyFAI\ext\_geometry.obj /OUT:build\lib.win-amd64-3.5\pyFAI\ext\_geometry.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\pyFAI\ext\_geometry.cp35-win_amd64.lib  
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe
building 'pyFAI.ext.reconstruct' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\reconstruct.c /Fobuild\temp.win-amd64-3.5\Release\pyFAI\ext\reconstruct.obj /openmp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit_reconstruct build\temp.win-amd64-3.5\Release\pyFAI\ext\reconstruct.obj /OUT:build\lib.win-amd64-3.5\pyFAI\ext\reconstruct.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\pyFAI\ext\reconstruct.cp35-win_amd64.lib  
building 'pyFAI.ext.splitPixel' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IpyFAI\ext\include -IpyFAI\ext -IC:\Users\valls\pyFAI_venv\lib\site-packages\numpy\core\include -Ic:\python35-amd64\include -Ic:\python35-amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcpyFAI\ext\splitPixel.c /Fobuild\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixel.obj
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\python35-amd64\Libs /LIBPATH:C:\Users\valls\pyFAI_venv\libs /LIBPATH:C:\Users\valls\pyFAI_venv\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit_splitPixel build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixel.obj /OUT:build\lib.win-amd64-3.5\pyFAI\ext\splitPixel.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\pyFAI\ext\splitPixel.cp35-win_amd64.lib
...
```

So, if problem occur also with patches disabled, the problem seem to not come from `setuptools/msvc.py` but from another change from Setuptools 24. But I don't see other change in changelog.

I can try a git-bisect next week, if it can help

Git-bisect is a good idea. Also, for reference, here's [the difference between v23.2.1 and v24.0.0](https://github.com/pypa/setuptools/compare/v23.2.1...v24.0.0). Basically everything in the MSVC support changed :/ and nothing else.

Also, there were some regressions identified, so do try the latest version also to see if perhaps that helps.

Hi. Here is the result of git bisect

```
75282e5568039e3dae52ee41ada35baf56f0567c is the first bad commit
commit 75282e5568039e3dae52ee41ada35baf56f0567c
Author: JGoutin <ginnungagap@free.fr>
Date:   Wed Mar 2 18:51:40 2016 +0000
```

Commit https://github.com/pypa/setuptools/commit/75282e5568039e3dae52ee41ada35baf56f0567c

I don't understand the cause of this error...
Maybe finding the function in distutils which add quotes on paths will help to found solution.

Iv got something which work.

Here is my patch

```
 try:
     # Distutil file for MSVC++ 14.0 and upper
-    import distutils._msvccompiler as msvc14compiler
+    import distutils.msvc9compiler as msvc14compiler
 except ImportError:
     pass
```

Does it mean `distutils._msvccompiler` is buggy?

With this, the monkey patch line 81 will fail. So `distutils._msvccompiler` is used unpatched. This confirm the issue is `msvc.py` related.

Oh... of cours...

Last things,
- when linking fail `gen_lib_options` come from distutils
- when it works `gen_lib_options` come from numpy

Im lost for today :-)


Resolving patch:
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -85,6 +85,13 @@ def patch_for_specialized_compiler():
     except Exception:
         pass
 
+    try:
+        # Patch distutils._msvccompiler.MSVCCompiler.library_dir_option
+        unpatched['msvc14_library_dir_option'] = msvc14compiler.MSVCCompiler.library_dir_option
+        msvc14compiler.MSVCCompiler.library_dir_option = msvc14_library_dir_option
+    except Exception:
+        pass
+
 
 def msvc9_find_vcvarsall(version):
     """
@@ -212,6 +219,26 @@ def msvc14_get_vc_env(plat_spec):
         raise
 
 
+def msvc14_library_dir_option(self, dir):
+    """
+    Patched "distutils._msvccompiler.MSVCCompiler.library_dir_option"
+    to fix unquoted path in "\LIBPATH" argument when a space is on path.
+
+    Parameters
+    ----------
+    dir: str
+        Path to convert in "\LIBPATH" argument.
+
+    Return
+    ------
+    "\LIBPATH" argument: str
+    """
+    if ' ' in dir and '"' not in dir:
+        # Quote if space and not already quoted
+        dir = '"%s"' % dir
+    return unpatched['msvc14_library_dir_option'](self, dir)
+
+
 def _augment_exception(exc, version, arch=''):
     """
     Add details to the exception message to help guide the user


Test patch: