Skip to content

Fails to build Python API on aarch64 platform #294

@steve-jeffrey

Description

@steve-jeffrey

What happened?

Building the Python API failed because the sse2 and avx2 extensions are not relevant in the aarch64 environment.

How to reproduce the issue

git clone https://github.com/quantumlib/Stim.git
cd Stim/
cmake .
make stim
python -m venv stim_env 3.8
. ./stim_env/bin/activate
pip install --upgrade pip pybind11 pytest
python setup.py bdist

Relevant log output

running bdist
running bdist_dumb
running build
running build_py
creating python_build_stim
creating python_build_stim/lib.linux-aarch64-3.8
creating python_build_stim/lib.linux-aarch64-3.8/stim
copying glue/python/src/stim/_main_argv.py -> python_build_stim/lib.linux-aarch64-3.8/stim
copying glue/python/src/stim/__init__.py -> python_build_stim/lib.linux-aarch64-3.8/stim
running egg_info
creating stim.egg-info
writing stim.egg-info/PKG-INFO
writing dependency_links to stim.egg-info/dependency_links.txt
writing entry points to stim.egg-info/entry_points.txt
writing requirements to stim.egg-info/requires.txt
writing top-level names to stim.egg-info/top_level.txt
writing manifest file 'stim.egg-info/SOURCES.txt'
reading manifest file 'stim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'stim.egg-info/SOURCES.txt'
copying glue/python/src/stim/__init__.pyi -> python_build_stim/lib.linux-aarch64-3.8/stim
running build_ext
building 'stim._detect_machine_architecture' extension
creating python_build_stim/temp.linux-aarch64-3.8
creating python_build_stim/temp.linux-aarch64-3.8/src
creating python_build_stim/temp.linux-aarch64-3.8/src/stim
creating python_build_stim/temp.linux-aarch64-3.8/src/stim/py
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I<site-packages>/pybind11/include -Isrc -I./stim_env/include -I/usr/include/python3.8 -c src/stim/py/march.pybind.cc -o python_build_stim/temp.linux-aarch64-3.8/src/stim/py/march.pybind.o -std=c++11 -fno-strict-aliasing -O3 -g0 -DVERSION_INFO=1.10.dev0 -mno-sse2 -mno-avx2
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-sse2’
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-avx2’
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

Other information
If the sse2 and avx2 sections in setup.py are removed, the API build successfully and all tests pass.

To remove those sections, apply the attached setup.py_patch.txt:
patch setup.py setup.py_patch.txt

Environment
Stim commit 81142ac

Ubuntu 20.04, GCC 9.4.0, Ampere Altra Max without SSE, SSE2, AVX and AVX2

Note: the issue does not occur in this environment: Fedora 35, GCC 11.3.1, Intel architecture with SSE, SSE2, AVX and AVX2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions