GitHub macos-14运行器中cibuildwheel+scikit-build-core致CMAKE_SYSTEM_PROCESSOR值错误
问题:macOS arm64环境下cibuildwheel构建时CMAKE_SYSTEM_PROCESSOR错误显示为x86_64
在macOS 14(arm64)环境中,使用cibuildwheel构建Python wheel时,CMake的CMAKE_SYSTEM_PROCESSOR变量输出为x86_64,但预期值应为arm64。直接通过CMake命令行构建时,该变量能正确输出arm64。
复现文件
main.cpp
#include <iostream> int main() { std::cout << "hello\n"; }
CMakeLists.txt
cmake_minimum_required(VERSION 3.25) project(hello) set(CMAKE_CXX_STANDARD 17) message("CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") add_executable(hello main.cpp)
build-wheel.yml(存在问题的wheel构建工作流)
name: build-wheels on: push: jobs: build_wheels: name: Build wheel runs-on: macos-14 steps: - uses: actions/checkout@v3 - name: Select Xcode run: sudo xcode-select -s /Applications/Xcode_15.4.app - name: Install Homebrew and packages run: | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew update brew install ninja - name: Build wheels uses: pypa/cibuildwheel@v2.19 env: CIBW_BUILD: cp38-macosx_arm64 CIBW_BUILD_VERBOSITY: 2 CIBW_ENVIRONMENT_MACOS: > CC=gcc-14 CXX=g++-14 MACOSX_DEPLOYMENT_TARGET=13.0
pyproject.toml
[build-system] requires = ["scikit-build-core>=0.9.0"] build-backend = "scikit_build_core.build" [project] name = "hello" version = "0.0.1dev0" requires-python = ">=3.8" dependencies = [] classifiers = [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] [tool.scikit-build] wheel.expand-macos-universal-tags = true cmake.version = ">=3.25" cmake.build-type = "Release" cmake.verbose = true logging.level = "INFO" [tool.cibuildwheel] build = "*" skip = "cp3{6,7}-*"
build.yml(可正常获取arm64值的直接构建工作流)
name: build on: push: jobs: build: name: Build runs-on: macos-14 steps: - uses: actions/checkout@v3 - name: Select Xcode run: sudo xcode-select -s /Applications/Xcode_15.4.app - name: Install Homebrew and packages run: | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew update brew install ninja - name: "Build" run: | rm -rf build && mkdir build && cd build cmake -DCMAKE_C_COMPILER=gcc-14 \ -DCMAKE_CXX_COMPILER=g++-14 \ -DCMAKE_BUILD_TYPE=Release \ -GNinja .. ninja
内容的提问来源于stack exchange,提问作者Jiawei Lu
相关产品推荐
相关产品推荐

