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

Compile FriBiDi for Windows ARM64 #7629

Merged
merged 3 commits into from
Dec 26, 2023
Merged

Conversation

nulano
Copy link
Contributor

@nulano nulano commented Dec 20, 2023

Add a build of ARM64 fribidi.dll to the wheels workflow.

This will simplify manually testing the ARM64 wheels on release day as well as allow users to download a pre-compiled DLL.

Since CMake does not support mixed host and cross compiling in the same project, the ARM64 build of fribidi.dll is now split into two steps (inspired by this StackOverflow answer):

  • compile and run helper programs using x86 architecture (x86 programs can also be run on ARM64 using builtin emulation),
  • compile fribidi.dll for ARM64 using generated tables from the previous step.

I've also removed the "Prepare to upload FriBiDi" step as it is no longer used with actions/upload-artifact@v4.

I've tested the changes as follows.

I first installed the built pillow-10.2.0.dev0-cp312-cp312-win_arm64 on an ARM64 Windows VM and ran Pytest:

C:\Users\UTM\Downloads\Pillow-arm64-fribidi-2\Pillow-arm64-fribidi-2>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\UTM\AppData\Local\Microsoft\WindowsApps

C:\Users\UTM\Downloads\Pillow-arm64-fribidi-2\Pillow-arm64-fribidi-2>"\Program Files\Python312-arm64\python.exe" -m pytest Tests
=== test session starts ===
platform win32 -- Python 3.12.0, pytest-7.4.3, pluggy-1.3.0
--------------------------------------------------------------------
Pillow 10.2.0.dev0
Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:15:47) [MSC v.1935 64 bit (ARM64)]
--------------------------------------------------------------------
Python modules loaded from C:\Program Files\Python312-arm64\Lib\site-packages\PIL
Binary modules loaded from C:\Program Files\Python312-arm64\Lib\site-packages\PIL
--------------------------------------------------------------------
...
*** RAQM (Bidirectional Text) support not installed
...
=== 2999 passed, 296 skipped, 3 xfailed, 1 xpassed in 82.71s (0:01:22) ===

I then added the path to the extracted fribidi-windows-ARM64 artifact to PATH (i.e. cross compiled on GHA) and ran Pytest again:

C:\Users\UTM\Downloads\Pillow-arm64-fribidi-2\Pillow-arm64-fribidi-2>path
PATH=C:\Users\UTM\Downloads\windows-fribidi-ARM64\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\UTM\AppData\Local\Microsoft\WindowsApps
...
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.13, harfbuzz 8.3.0
...
=== 3169 passed, 126 skipped, 3 xfailed, 1 xpassed in 68.30s (0:01:08) ===

And finally, I ran build_prepare.py and the generated build_dep_fribidi.cmd on the ARM64 VM, replaced the directory in PATH with the new build, and ran Pytest for a third time:

C:\Users\UTM\Downloads\Pillow-arm64-fribidi-2\Pillow-arm64-fribidi-2>path
PATH=C:\Users\UTM\Downloads\Pillow-arm64-fribidi-2\Pillow-arm64-fribidi-2\winbuild\build\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\UTM\AppData\Local\Microsoft\WindowsApps
...
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.13, harfbuzz 8.3.0
...
=== 3169 passed, 126 skipped, 3 xfailed, 1 xpassed in 71.89s (0:01:11) ===

@radarhere radarhere merged commit f8e65ec into python-pillow:main Dec 26, 2023
65 checks passed
@nulano nulano deleted the arm64-fribidi-2 branch December 26, 2023 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants