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

bpo-42405: fix C extensions build on Windows ARM64 #23399

Merged
merged 2 commits into from Mar 4, 2021

Conversation

Copy link
Contributor

@ader1990 ader1990 commented Nov 19, 2020

The following changes are required:

  * add a new platform win-arm64
  * replace the emulated compiler executable paths
  * bump the linker base addressed as ARM64 requires more memory
    this change might not be needed (investigation required)

On Windows 10 ARM64, VS compiler paths look like this:
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\ARM64\cl.exe

Note that the cl.exe for ARM64 is an x32 binary, which can run emulated
on Windows 10 ARM64 (it has builtin emulation for x32).

The rc.exe and mc.exe paths have to also be changed, as the initial
discovery has to be fixed.

Work in progress to remove the hardcoded bits and to change the path
query fixes to the proper location.

https://bugs.python.org/issue42405

Automerge-Triggered-By: GH:jaraco

@the-knights-who-say-ni
Copy link

@the-knights-who-say-ni the-knights-who-say-ni commented Nov 19, 2020

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@ader1990

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@jaraco
Copy link

@jaraco jaraco commented Nov 22, 2020

Thanks Adrian for preparing this. It's clear from the description that it's a draft, so I've marked it as such. Surely, it won't be reviewable until the existing CI passes.

It appears this patch is meant to demonstrate the minimum changes to replace support for x86/amd64 with support for ARM, but whatever solution is accepted will need to remain compatible for x86 and amd64.

The following changes are required:

  * add a new platform win-arm64
  * replace the emulated compiler executable paths
  * bump the linker base addressed as ARM64 requires more memory
    this change might not be needed (investigation required)

On Windows 10 ARM64, VS compiler paths look like this:
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\ARM64\cl.exe
Note that the cl.exe for ARM64 is an x32 binary, which can run emulated
on Windows 10 ARM64 (it has builtin emulation for x32).

The rc.exe and mc.exe paths have to also be changed, as the initial
discovery has to be fixed.
@ader1990
Copy link
Author

@ader1990 ader1990 commented Nov 23, 2020

Hello @jaraco,

I have updated the code to be backwards compatible for the x86/x64 versions. The patch should pass the CI, although I am thinking of further cleaning the code by using a replace dictionary instead of the hardcoded in-place replacements.
Still, with the replace dict in place, the code is brittle, but I do not have a better solution at this moment.

To keep the discussion in the right direction, this patch is used to build projects that have C-extensions and do rely on older VS implementation, like pywin32, cffi. There are probably other packages or older versions that have the same problem.

Thank you,
Adrian Vladu

@ader1990 ader1990 marked this pull request as ready for review Nov 23, 2020
@github-actions
Copy link

@github-actions github-actions bot commented Dec 24, 2020

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 24, 2020
@jaraco jaraco added the 🤖 automerge label Mar 4, 2021
@miss-islington
Copy link

@miss-islington miss-islington commented Mar 4, 2021

@ader1990: Status check is done, and it's a success .

@miss-islington
Copy link

@miss-islington miss-islington commented Mar 4, 2021

@ader1990: Status check is done, and it's a success .

@miss-islington
Copy link

@miss-islington miss-islington commented Mar 4, 2021

Sorry, I can't merge this PR. Reason: 2 of 4 required status checks are expected..

@miss-islington
Copy link

@miss-islington miss-islington commented Mar 4, 2021

@ader1990: Status check is done, and it's a success .

@miss-islington miss-islington merged commit cb7bc76 into python:master Mar 4, 2021
11 checks passed
jaraco added a commit that referenced this issue Mar 4, 2021
gvanrossum pushed a commit to gvanrossum/cpython that referenced this issue Mar 10, 2021
The following changes are required:

      * add a new platform win-arm64
      * replace the emulated compiler executable paths
      * bump the linker base addressed as ARM64 requires more memory
        this change might not be needed (investigation required)

    On Windows 10 ARM64, VS compiler paths look like this:
    C:\Program Files (x86)\Microsoft Visual
    Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\ARM64\cl.exe

    Note that the cl.exe for ARM64 is an x32 binary, which can run emulated
    on Windows 10 ARM64 (it has builtin emulation for x32).

    The rc.exe and mc.exe paths have to also be changed, as the initial
    discovery has to be fixed.

    Work in progress to remove the hardcoded bits and to change the path
    query fixes to the proper location.

Automerge-Triggered-By: GH:jaraco
gvanrossum pushed a commit to gvanrossum/cpython that referenced this issue Mar 10, 2021
kreathon pushed a commit to kreathon/cpython that referenced this issue May 2, 2021
The following changes are required:

      * add a new platform win-arm64
      * replace the emulated compiler executable paths
      * bump the linker base addressed as ARM64 requires more memory
        this change might not be needed (investigation required)

    On Windows 10 ARM64, VS compiler paths look like this:
    C:\Program Files (x86)\Microsoft Visual
    Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\ARM64\cl.exe

    Note that the cl.exe for ARM64 is an x32 binary, which can run emulated
    on Windows 10 ARM64 (it has builtin emulation for x32).

    The rc.exe and mc.exe paths have to also be changed, as the initial
    discovery has to be fixed.

    Work in progress to remove the hardcoded bits and to change the path
    query fixes to the proper location.

Automerge-Triggered-By: GH:jaraco
kreathon pushed a commit to kreathon/cpython that referenced this issue May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA signed 🤖 automerge stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants