Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building on macOS: undeclared identifier '_SC_PHYS_PAGES' #1689

Closed
wshanks opened this issue Dec 22, 2022 · 3 comments
Closed

Error building on macOS: undeclared identifier '_SC_PHYS_PAGES' #1689

wshanks opened this issue Dec 22, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@wshanks
Copy link
Contributor

wshanks commented Dec 22, 2022

Informations

  • Qiskit Aer version: 0.11.2
  • Python version: 3.10.8
  • Operating system: macOS 11.7.2

What is the current behavior?

When trying to build qiskit-aer, I encounter the following error (build log):

  [9/11] Building CXX object qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o
  FAILED: qiskit_aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o
  /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/_build_env/bin/x86_64-apple-darwin13.4.0-clang++ -Dcontroller_wrappers_EXPORTS -I/Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python3.10 -I/Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.10/site-packages/pybind11/include -I/Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/src -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include -fdebug-prefix-map=/Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work=/usr/local/src/conda/qiskit-aer-0.11.2 -fdebug-prefix-map=/Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol=/usr/local/src/conda-prefix -pedantic -Wall -Wfloat-equal -Wundef -Wcast-align -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wshadow -Woverloaded-virtual -fopenmp=libomp -mpopcnt -O3 -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -fPIC -fvisibility=hidden   -fopenmp=libomp -std=gnu++14 -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/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/qiskit_aer/backends/wrappers/bindings.cc
  In file included from /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/qiskit_aer/backends/wrappers/bindings.cc:19:
  In file included from /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/src/framework/results/pybind_result.hpp:20:
  In file included from /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/src/framework/results/legacy/pybind_data.hpp:19:
  In file included from /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/src/framework/results/legacy/snapshot_data.hpp:22:
  /Users/runner/mambaforge/conda-bld/qiskit-aer_1671388392802/work/src/framework/utils.hpp:1280:34: error: use of undeclared identifier '_SC_PHYS_PAGES'
    size_t pages = (size_t)sysconf(_SC_PHYS_PAGES);
                                   ^

Steps to reproduce the problem

I think this is a bit tricky but the simplest way would be to use conda and conda-build to try to build the recipe in conda-forge/staged-recipes#21404 for qiskit-aer (install conda-build, check out that branch, and run conda-build recipes/qiskit-aer/meta.yaml).

What is the expected behavior?

qiskit-aer builds successfully.

Suggested solutions

Comparing the build environment in the qiskit-aer GitHub Actions CI with the environment from the conda-forge CI (like the one in the build log), what stands out to me is that in the qiskit-aer CI cmake reports the compiler as AppleClang 14.0.0.14000029 while in the conda-forge CI it is reported as Clang 14.0.6. My guess is that _SC_PHYS_PAGES is included in an Apple specific header that the conda build of clang does not include?

Searching for _SC_PHYS_PAGES and osx turns up a few things, mostly related to people trying to compile Linux programs on macOS using gcc. Could qiskit-aer do something like this?

@wshanks wshanks added the bug Something isn't working label Dec 22, 2022
@hhorii
Copy link
Collaborator

hhorii commented Feb 20, 2023

Could you give steps to reproduce this problem? I got following message after pip install conda-build, checked out conda-forge/staged-recipes@15d761a, and conda-build recipes/qiskit-aer/meta.yaml.

$ conda-build recipes/qiskit-aer/meta.yaml
/conda/lib/python3.9/site-packages/conda_build/cli/main_build.py:390: UserWarning: RECIPE_PATH received is a file (recipes/qiskit-aer/meta.yaml).
It should be a path to a folder.
Forcing conda-build to use the recipe file.
  warnings.warn(
No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.16
WARNING:conda_build.metadata:No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.16
Adding in variants from internal_defaults
INFO:conda_build.variants:Adding in variants from internal_defaults
/conda/lib/python3.9/site-packages/conda_build/environ.py:433: UserWarning: The environment variable 'DISABLE_DEPENDENCY_INSTALL' is being passed through with value 'ON'.  If you are splitting build and test phases with --no-test, please ensure that this value is also set similarly at test time.
  warnings.warn(
/conda/lib/python3.9/site-packages/conda_build/environ.py:433: UserWarning: The environment variable 'DISABLE_CONAN' is being passed through with value 'ON'.  If you are splitting build and test phases with --no-test, please ensure that this value is also set similarly at test time.
  warnings.warn(
/conda/lib/python3.9/site-packages/conda_build/environ.py:433: UserWarning: The environment variable 'SKBUILD_CONFIGURE_OPTIONS' is being passed through with value '"-GNinja"'.  If you are splitting build and test phases with --no-test, please ensure that this value is also set similarly at test time.
  warnings.warn(
Skipped: qiskit-aer from /HOME/staged-recipes/recipes/qiskit-aer defines build/skip for this configuration ({'numpy': '1.16', 'cxx_compiler': 'clangxx', 'python': '3.9', 'target_platform': 'osx-64'}).
Renaming work directory '/conda/conda-bld/qiskit-aer_1676886860845/work' to '/conda/conda-bld/qiskit-aer_1676886860845/work_moved_qiskit-aer-0.11.2-py39h331c576_0_osx-64_main_build_loop'
INFO:conda_build.utils:Renaming work directory '/conda/conda-bld/qiskit-aer_1676886860845/work' to '/conda/conda-bld/qiskit-aer_1676886860845/work_moved_qiskit-aer-0.11.2-py39h331c576_0_osx-64_main_build_loop'
shutil.move(work)=/conda/conda-bld/qiskit-aer_1676886860845/work, dest=/conda/conda-bld/qiskit-aer_1676886860845/work_moved_qiskit-aer-0.11.2-py39h331c576_0_osx-64_main_build_loop)
INFO:conda_build.utils:shutil.move(work)=/conda/conda-bld/qiskit-aer_1676886860845/work, dest=/conda/conda-bld/qiskit-aer_1676886860845/work_moved_qiskit-aer-0.11.2-py39h331c576_0_osx-64_main_build_loop)

INFO :: The inputs making up the hashes for the built packages are as follows:
{}


####################################################################################
Resource usage summary:

Total time: 0:00:00.1
CPU usage: sys=0:00:00.0, user=0:00:00.0
Maximum memory usage observed: 0B
Total disk usage observed (not including envs): 0B

@hhorii
Copy link
Collaborator

hhorii commented May 16, 2023

Please let me close this issue because of no response in more than 2 months. Please create a new issue if this issue still remains.

@hhorii hhorii closed this as completed May 16, 2023
@wshanks
Copy link
Contributor Author

wshanks commented May 16, 2023

Oh, wow, I never noticed that you replied to this. I had been waiting for a response. Can we just reopen this? I will make a new issue if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants