Skip to content

Issues building on latest macOS #2356

@billti

Description

@billti

I tried following the build steps in CONTRIBUTING.md and hit a number of issues.

I did the brew install openblas and xcode-select --install and pip install -r requirements-dev.txt with no issues. My first attempt was using the debug build command outlined, namely

VERBOSE=1 python ./setup.py bdist_wheel --build-type=Debug 2>&1|tee build.log

This resulted in the below error:

ERROR: Invalid setting '17.0' is not a valid 'settings.compiler.version' value.
Possible values are ['5.0', '5.1', '6.0', '6.1', '7.0', '7.3', '8.0', '8.1', '9.0', '9.1', '10.0', '11.0', '12.0', '13', '13.0', '13.1', '14', '14.0', '15', '15.0', '16', '16.0']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
CMake Error at cmake/conan.cmake:404 (message):
  Conan install failed='1'
Call Stack (most recent call first):
  cmake/conan.cmake:499 (conan_cmake_install)
  cmake/conan_utils.cmake:53 (conan_cmake_run)
  cmake/dependency_utils.cmake:20 (setup_conan)
  CMakeLists.txt:179 (setup_dependencies)

After some internet sleuthing I updated the file in ~/.conan/settings.yml to add "17.0" to the 'compiler/apple-clang' list. On re-run this got a bit further then failed with:

llvm-openmp/12.0.1: Not found in local cache, looking in remotes...
llvm-openmp/12.0.1: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
llvm-openmp/12.0.1: Downloaded recipe revision 0
conanfile.txt: Installing package
Requirements
    fmt/8.0.1 from 'conancenter' - Downloaded
    llvm-openmp/12.0.1 from 'conancenter' - Downloaded
    nlohmann_json/3.1.1 from 'conancenter' - Downloaded
    spdlog/1.9.2 from 'conancenter' - Downloaded
Packages
    fmt/8.0.1:09b1139659107caa7893019de88aa1dc752a7179 - Build
    llvm-openmp/12.0.1:INVALID - Invalid
    nlohmann_json/3.1.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Download
    spdlog/1.9.2:523d331413555dbf719c0ad2d40e0b4058afa96c - Build

Installing (downloading, building) binaries...
ERROR: There are invalid packages (packages that cannot exist for this configuration):
llvm-openmp/12.0.1: Invalid ID: Debug mode not supported for ARM v8
CMake Error at cmake/conan.cmake:404 (message):
  Conan install failed='6'
Call Stack (most recent call first):
  cmake/conan.cmake:499 (conan_cmake_install)
  cmake/conan_utils.cmake:53 (conan_cmake_run)
  cmake/dependency_utils.cmake:20 (setup_conan)
  CMakeLists.txt:179 (setup_dependencies)

OK. So looks like the OpenMP dependency has issues with debug builds. Removed that flag and tried again with just VERBOSE=1 python ./setup.py bdist_wheel 2>&1|tee build.log

This got a lot further then failed with:

Run Build Command(s): /opt/homebrew/bin/ninja -v install
[1/3] ccache /usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -Dcontroller_wrappers_EXPORTS -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/Users/billti/src/qiskit-aer/src -I/Users/billti/.conan/data/llvm-openmp/12.0.1/_/_/package/f6f551e1777edaff347d0e747b6d25e62a54253d/include -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks -isystem /Users/billti/.conan/data/nlohmann_json/3.1.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -isystem /Users/billti/.conan/data/spdlog/1.9.2/_/_/package/5c18d941a437277a3c76ba69ed8f3aa36aa68889/include -isystem /Users/billti/.conan/data/fmt/8.0.1/_/_/package/7f7d38a26d4a6e6af133b82f872dee1eaeb3996d/include -stdlib=libc++ -pedantic -Wall -Wfloat-equal -Wundef -Wcast-align -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wshadow -Woverloaded-virtual  -Xpreprocessor -fopenmp -O3 -DNDEBUG -std=gnu++14 -arch arm64 -mmacosx-version-min=15.0 -fPIC -fvisibility=hidden -MD -MT qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o -MF qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o.d -o qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o -c /Users/billti/src/qiskit-aer/qiskit_aer/backends/wrappers/bindings.cc
FAILED: qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o
ccache /usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -Dcontroller_wrappers_EXPORTS -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/Users/billti/src/qiskit-aer/src -I/Users/billti/.conan/data/llvm-openmp/12.0.1/_/_/package/f6f551e1777edaff347d0e747b6d25e62a54253d/include -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks -isystem /Users/billti/.conan/data/nlohmann_json/3.1.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -isystem /Users/billti/.conan/data/spdlog/1.9.2/_/_/package/5c18d941a437277a3c76ba69ed8f3aa36aa68889/include -isystem /Users/billti/.conan/data/fmt/8.0.1/_/_/package/7f7d38a26d4a6e6af133b82f872dee1eaeb3996d/include -stdlib=libc++ -pedantic -Wall -Wfloat-equal -Wundef -Wcast-align -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wshadow -Woverloaded-virtual  -Xpreprocessor -fopenmp -O3 -DNDEBUG -std=gnu++14 -arch arm64 -mmacosx-version-min=15.0 -fPIC -fvisibility=hidden -MD -MT qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o -MF qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o.d -o qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o -c /Users/billti/src/qiskit-aer/qiskit_aer/backends/wrappers/bindings.cc
/Users/billti/src/qiskit-aer/qiskit_aer/backends/wrappers/bindings.cc:9:10: fatal error: 'pybind11/pybind11.h' file not found
    9 | #include <pybind11/pybind11.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

Traceback (most recent call last):
  File "/Users/billti/src/qiskit-aer/.venv/lib/python3.13/site-packages/skbuild/setuptools_wrap.py", line 668, in setup
    cmkr.make(make_args, install_target=cmake_install_target, env=env)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/billti/src/qiskit-aer/.venv/lib/python3.13/site-packages/skbuild/cmaker.py", line 696, in make
    self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/billti/src/qiskit-aer/.venv/lib/python3.13/site-packages/skbuild/cmaker.py", line 741, in make_impl
    raise SKBuildError(msg)

After some more internet sleuthing I found at https://pybind11.readthedocs.io/en/latest/installing.html#include-with-pypi the command pip install "pybind11[global]" (just pip install pybind didn't fix it).

After blowing away the ./_skbuild dir and trying again, VERBOSE=1 python ./setup.py bdist_wheel 2>&1|tee build.log finally worked!

So a summary of issues/questions:

  • How to fix the clang 17 compiler issue? My manual edit of the conan file seems like a hack.
  • Should the pybind[global] package be added to requirements-dev.txt?
  • Any idea how to get the debug build working? That again seems like a conan issue, where it is potentially trying to use 'ARM v8' where it should be 'ARM64'. (I read similar issues such as ImportError for Qiskit Aer built from source for MacOS arm64 #1286 with no luck).

Note I'm using a straight Python 3.13 venv, not Conda.

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