Skip to content

[BUG] win-arm64 platform is not detected #2724

@zooba

Description

@zooba

setuptools version

latest

Python version

any

OS

Windows

Additional environment information

Only relevant when %VSCMD_ARG_TGT_ARCH% is set to arm64 (for example, in a configured build environment).

Description

For other values (x86, x64, arm), the VSCMD_ARG_TGT_ARCH variable is used to select the platform specifier (see setuptools/_distutils/util.py line 100ish). There is no value for arm64, and so it builds for the current platform rather than cross-compiling.

Expected behavior

When the value is arm64, it should select platform win-arm64. This allows later steps to select the correct build tools and cross-compile.

Note that you also need to [obtain and] ensure that setuptools will find the ARM64 compatible .lib files for Python. Putting them into a venv's libs directory works fine (provided you make sure the build happens in that venv, which is not hard).

How to Reproduce

  1. Open regular command prompt
  2. set VSCMD_ARG_TGT_ARCH=arm64
  3. pip wheel --no-binary :all: --no-deps --no-cache --no-build-isolation markupsafe (or any other simple module with native code)

The generated wheel will be for the same platform as the Python it was run with, rather than respecting the target architecture.

If you set VSCMD_ARG_TGT_ARCH=arm without getting the right libs, the compilation fails and it generates a none-any wheel because markupsafe knows how to handle this. Other packages will just hard fail.

Output

Collecting markupsafe                                                                                                   
  Downloading MarkupSafe-2.0.1.tar.gz (18 kB)                                                                           
Building wheels for collected packages: markupsafe                                                                      
  Building wheel for markupsafe (setup.py) ... done                                                                     
  Created wheel for markupsafe: filename=MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl size=17214 sha256=cd682d318cfd3a5805c032fa6b1d9e40def490f62be7b4057fcd67cf4f6cc1dc                                                                            
  Stored in directory: C:\...\Temp\pip-ephem-wheel-cache-lgs8awq4\wheels\9f\6d\c8\1f59b07cf85ae842908006ec28f4477f7e4578df72c3eb0e46                                                                                     
Successfully built markupsafe                                                                                           

Note that the wheel platform is win32 or win_amd64, and not win_arm64.

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions