History

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.

Paul Brossier committed 7 years ago

Commit 062eaf12 parents 7ed058c 0b9e3b82 files · +12 −8Browse files

Unified · Split

2 files
  1. .appveyor.yml +0 −8
  2. python/lib/gen_external.py +12 −0
.appveyor.yml+0−8
@@ -3,9 +3,6 @@ · 2 unmodified lines
33
44 environment:
55
6− global:
7− CUSTOM64PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
8−
96 matrix:
107
118 # pre-installed python version, see:
@@ -43,14 +40,11 @@ environment: · 31 unmodified lines
4340 PYTHON_ARCH: 64
4441
4542 install:
46−
4743 - ECHO "Installed SDKs:"
4844 - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
4945
5046 - "SET PATH=%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
5147
52− - if [%PYTHON_ARCH%]==[64] SET PATH=%CUSTOM64PATH%;%PATH%
53−
5448 # Check that we have the expected version and architecture for Python
5549 - "python --version"
5650 - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
@@ -71,8 +65,6 @@ build_script: · 14 unmodified lines
7165 - python waf configure build install --verbose --msvc_version="msvc 14.0"
7266 # clean before building python package
7367 - python waf distclean
74− # build python module without using libaubio
75− - pip wheel -v -v -v --wheel-dir=dist .
7668 # build, upload and install wheel (inspired by numpy's appveyor)
7769 - ps: |
7870 pip wheel -v -v -v --wheel-dir=dist .
python/lib/gen_external.py+12−0
@@ -74,6 +74,18 @@ def get_preprocessor(): · 73 unmodified lines
7474 cpp_cmd = compiler.cc.split()
7575 cpp_cmd += ['-E']
7676
77+ # On win-amd64 (py3.x), the default compiler is cross-compiling, from x86
78+ # to amd64 with %WIN_SDK_ROOT%\x86_amd64\cl.exe, but using this binary as a
79+ # pre-processor generates no output, so we use %WIN_SDK_ROOT%\cl.exe
80+ # instead.
81+ if len(cpp_cmd) > 1 and 'cl.exe' in cpp_cmd[-2]:
82+ plat = os.path.basename(os.path.dirname(cpp_cmd[-2]))
83+ if plat == 'x86_amd64':
84+ print('workaround on win64 to avoid empty pre-processor output')
85+ cpp_cmd[-2] = cpp_cmd[-2].replace('x86_amd64', '')
86+ elif True in ['amd64' in f for f in cpp_cmd]:
87+ print('warning: not using workaround for', cpp_cmd[0], plat)
88+
7789 if not cpp_cmd:
7890 print("Warning: could not guess preprocessor, using env's CC")
7991 cpp_cmd = os.environ.get('CC', 'cc').split()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t