Hi Pieter. We ran into an interesting corner case running on an Apple M2 CPU running Anaconda installed for x86_64
(which I suppose macOS then emulates for automatically). The most correct solution to the problem is simply to install Anaconda for arm64
, then everything works as expected. I thought we should report the experience anyway, in case you think there is something that can/should be done in py-build-cmake for it, though I'm not requesting that you do so.
I'm not entirely sure what the correct thing to do should be, but I don't think it should get into a situation where it's trying to link libraries of the wrong architecture. Perhaps at least one of:
Obtaining file:///Users/haonanwa/Projects/PipeEdge
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing editable metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [200 lines of output]
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.27.0/share/cmake/Modules/GNUInstallDirs.cmake:243 (message):
Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
target architecture is known. Please enable at least one language before
including GNUInstallDirs.
Call Stack (most recent call first):
CMakeLists.txt:3 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Checking for py-build-cmake environment - found
-- Using PEP 427-compatible install paths
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.4s)
-- Generating done (0.0s)
CMake Warning:
Manually-specified variables were not used by the project:
PY_BUILD_CMAKE_PACKAGE_NAME
Python3_EXECUTABLE
Python3_FIND_REGISTRY
Python3_FIND_STRATEGY
Python3_ROOT_DIR
-- Build files have been written to: /Users/haonanwa/Projects/PipeEdge/.py-build-cmake_cache/cp37-cp37m-macosx_10_9_x86_64
[ 66%] Building CXX object CMakeFiles/sched-pipeline.dir/sched-pipeline.cpp.o
[ 66%] Building CXX object CMakeFiles/sched-pipeline.dir/schedule.cpp.o
/Users/haonanwa/Projects/PipeEdge/src-native/schedule.cpp:200:10: warning: variable 'stage_num' set but not used [-Wunused-but-set-variable]
size_t stage_num = 0;
^
1 warning generated.
[100%] Linking CXX executable sched-pipeline
ld: warning: ignoring file /opt/homebrew/lib/libyaml-cpp.0.7.0.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"YAML::InvalidNode::~InvalidNode()", referenced from:
_main in sched-pipeline.cpp.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"vtable for YAML::Exception", referenced from:
YAML::Exception::Exception(YAML::Mark const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sched-pipeline.cpp.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sched-pipeline] Error 1
make[1]: *** [CMakeFiles/sched-pipeline.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
File "/Users/haonanwa/opt/anaconda3/envs/pipeedge/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 167, in prepare_metadata_for_build_editable
hook = backend.prepare_metadata_for_build_editable
AttributeError: module 'py_build_cmake.build' has no attribute 'prepare_metadata_for_build_editable'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/haonanwa/opt/anaconda3/envs/pipeedge/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/haonanwa/opt/anaconda3/envs/pipeedge/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/haonanwa/opt/anaconda3/envs/pipeedge/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
whl_basename = build_hook(metadata_directory, config_settings)
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/build.py", line 86, in build_editable
editable=True)
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/build.py", line 248, in build_wheel_in_dir
self.do_native_cross_cmake_build(paths, cfg, pkg_info)
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/build.py", line 334, in do_native_cross_cmake_build
cfg.cross, package_info, native_install_dir)
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/build.py", line 511, in run_cmake
cmaker.build()
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/cmake.py", line 190, in build
self.run(cmd, cwd=cwd, check=True, env=env)
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/cmake.py", line 68, in run
return self.runner.run(*args, **kwargs)
File "/private/var/folders/th/npccwh1j0hj106lcytk5m_4c0000gn/T/pip-build-env-zw52vokl/overlay/lib/python3.7/site-packages/py_build_cmake/cmd_runner.py", line 25, in run
return sp_run(*args, **kwargs)
File "/Users/haonanwa/opt/anaconda3/envs/pipeedge/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['cmake', '--build', '/Users/haonanwa/Projects/PipeEdge/.py-build-cmake_cache/cp37-cp37m-macosx_10_9_x86_64', '--config', 'RelWithDebInfo', '-j']' returned non-zero exit status 2.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Cheers.