ref: 062eaf1c8cf375e4cb3bcdd7b0b95d575fd4707d
parent: 7ed058cb5729e9ef8ed249e0ce233442537be3fc
parent: 0b9e3b8af7952c8321b6c53a06fd8abdd9332179
author: Paul Brossier <piem@piem.org>
date: Tue Nov 20 20:28:40 EST 2018
Merge branch 'fix/py3x_win-amd64' (closes #199, #208) Adds a workaround in gen_external.py to prevent the `Exception: preprocessor output is empty` build failure on windows amd64.
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -3,9 +3,6 @@
environment:
- global:
- CUSTOM64PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
-
matrix:
# pre-installed python version, see:
@@ -43,14 +40,11 @@
PYTHON_ARCH: 64
install:
-
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
- "SET PATH=%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
- - if [%PYTHON_ARCH%]==[64] SET PATH=%CUSTOM64PATH%;%PATH%
-
# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
@@ -71,8 +65,6 @@
- python waf configure build install --verbose --msvc_version="msvc 14.0"
# clean before building python package
- python waf distclean
- # build python module without using libaubio
- - pip wheel -v -v -v --wheel-dir=dist .
# build, upload and install wheel (inspired by numpy's appveyor)
- ps: |
pip wheel -v -v -v --wheel-dir=dist .
--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -74,6 +74,18 @@
cpp_cmd = compiler.cc.split()
cpp_cmd += ['-E']
+ # On win-amd64 (py3.x), the default compiler is cross-compiling, from x86
+ # to amd64 with %WIN_SDK_ROOT%\x86_amd64\cl.exe, but using this binary as a
+ # pre-processor generates no output, so we use %WIN_SDK_ROOT%\cl.exe
+ # instead.
+ if len(cpp_cmd) > 1 and 'cl.exe' in cpp_cmd[-2]:
+ plat = os.path.basename(os.path.dirname(cpp_cmd[-2]))
+ if plat == 'x86_amd64':
+ print('workaround on win64 to avoid empty pre-processor output')
+ cpp_cmd[-2] = cpp_cmd[-2].replace('x86_amd64', '')
+ elif True in ['amd64' in f for f in cpp_cmd]:
+ print('warning: not using workaround for', cpp_cmd[0], plat)
+
if not cpp_cmd:
print("Warning: could not guess preprocessor, using env's CC")
cpp_cmd = os.environ.get('CC', 'cc').split()