Skip to content

Commit 151b27f

Browse files
committed
olg gcc guard
1 parent f2e0002 commit 151b27f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/test_wheel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
os: [ubuntu-22.04, windows-2022]
12+
os: [ubuntu-24.04, windows-2022]
1313
architecture: ["x64"]
1414
linux_archs: ["native"]
1515
numpy_version: ["numpy#latest"]

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ def fix_exts(sources):
4343

4444
import platform
4545
_machine = platform.machine()
46-
_march = ['-march=x86-64-v2'] if _machine == 'x86_64' else []
46+
if _machine == 'x86_64':
47+
# x86-64-v2 requires GCC >= 11; probe before using it
48+
probe = subprocess.run(
49+
['cc', '-march=x86-64-v2', '-x', 'c', '-', '-fsyntax-only'],
50+
input=b'', capture_output=True
51+
)
52+
_march = ['-march=x86-64-v2'] if probe.returncode == 0 else []
53+
else:
54+
_march = []
4755
modules = [
4856
Extension(mod, fix_exts(sources), extra_compile_args=['-O3'] + _march)
4957
for mod, sources in modules_to_build.items()]

0 commit comments

Comments
 (0)