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

Failed to build Windows ARM64 dependencies #6679

Closed
infinitepower18 opened this issue Oct 23, 2022 · 19 comments · Fixed by #6718
Closed

Failed to build Windows ARM64 dependencies #6679

infinitepower18 opened this issue Oct 23, 2022 · 19 comments · Fixed by #6718

Comments

@infinitepower18
Copy link

infinitepower18 commented Oct 23, 2022

What did you do?

I'm trying to build a Python 3.11 ARM64 wheel for Windows ARM64 using the provided instructions and used the command build_prepare.py --architecture=ARM64. However it fails when I try to build the dependencies afterwards. I have Visual Studio Community 2022 installed on my system.

What did you expect to happen?

The dependencies should have been built successfully.

What actually happened?

Fails when trying to build for ARM64

What are your OS, Python and Pillow versions?

  • OS: Windows 11 Build 22621.675
  • Python: Python 3.11.0rc2
  • Pillow: Cloned GitHub main branch
PS C:\Users\Ahnaf\Desktop\Pillow\winbuild\build> .\build_dep_all.cmd

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build>cmd.exe /c "C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\build_dep_libjpeg.cmd"
======================================================================
==== Building libjpeg (libjpeg-turbo-2.1.4)                       ====
======================================================================

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build>cd /D C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>set INCLUDE=C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\inc

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>set INCLIB=C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\lib

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>set LIB=C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\lib

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>path C:\Program Files\PowerShell\7;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\msys64\mingw64\bin;C:\Program Files\dotnet\;C:\Gradle\gradle-7.4\bin;C:\Program Files (x86)\gnupg\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\MATLAB\R2022b\bin;C:\Users\Ahnaf\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files\PowerShell\7\;C:\Program Files\GitHub CLI\;C:\Users\Ahnaf\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\Ahnaf\AppData\Local\Programs\Python\Python311\;C:\Users\Ahnaf\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.3\bin;C:\Users\Ahnaf\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\JetBrains\PyCharm 2021.2.3\bin;C:\Program Files\JetBrains\CLion 2021.2.3\bin;C:\Program Files\heroku\bin;C:\Users\Ahnaf\AppData\Local\GitHubDesktop\bin;C:\Users\Ahnaf\.dotnet\tools;C:\Users\Ahnaf\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\Ahnaf\AppData\Local\Microsoft\WindowsApps;C:\Users\Ahnaf\.dotnet\tools;C:\flutter\bin;C:\Users\Ahnaf\AppData\Local\gitkraken\bin;C:\Users\Ahnaf\AppData\Local\Pub\Cache\bin;C:\Users\Ahnaf\.dotnet\tools;C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\bin

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_arm64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.3.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_arm64'

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED:BOOL=FALSE -DWITH_JPEG8:BOOL=TRUE -DWITH_CRT_DLL:BOOL=TRUE -G "NMake Makefiles" "."
-- The C compiler identification is MSVC 19.33.31630.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx86/x86/cl.exe - broken
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx86/x86/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Ahnaf/Desktop/Pillow/winbuild/build/libjpeg-turbo-2.1.4/CMakeFiles/CMakeTmp

    Run Build Command(s):nmake -f Makefile /nologo cmTC_21cae\fast &&   "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x86\nmake.exe"  -f CMakeFiles\cmTC_21cae.dir\build.make /nologo -L                  CMakeFiles\cmTC_21cae.dir\build
    Building C object CMakeFiles/cmTC_21cae.dir/testCCompiler.c.obj
        "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_21cae.dir\testCCompiler.c.obj.d --working-dir=C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4\CMakeFiles\CMakeTmp --filter-prefix="Note: including file: " -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx86\x86\cl.exe @C:\Users\Ahnaf\AppData\Local\Temp\nm8AF.tmp
    testCCompiler.c
    Linking C executable cmTC_21cae.exe
        "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_21cae.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x86\mt.exe --manifests -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\cmTC_21cae.dir\objects1.rsp @C:\Users\Ahnaf\AppData\Local\Temp\nm91E.tmp
    LINK Pass 1: command "C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\cmTC_21cae.dir\objects1.rsp /out:cmTC_21cae.exe /implib:cmTC_21cae.lib /pdb:C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4\CMakeFiles\CMakeTmp\cmTC_21cae.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_21cae.dir/intermediate.manifest CMakeFiles\cmTC_21cae.dir/manifest.res" failed (exit code 1104) with the following output:
    LINK : fatal error LNK1104: cannot open file 'MSVCRTD.lib'
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x86\nmake.exe"' : return code '0x2'
    Stop.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:12 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Ahnaf/Desktop/Pillow/winbuild/build/libjpeg-turbo-2.1.4/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Ahnaf/Desktop/Pillow/winbuild/build/libjpeg-turbo-2.1.4/CMakeFiles/CMakeError.log".

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>nmake.exe -nologo   "clean"
NMAKE : fatal error U1073: don't know how to make 'clean'
Stop.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>nmake.exe -nologo   "jpeg-static"
NMAKE : fatal error U1073: don't know how to make 'jpeg-static'
Stop.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "jpeg-static.lib" "libjpeg.lib"
The system cannot find the file specified.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>nmake.exe -nologo   "cjpeg-static"
NMAKE : fatal error U1073: don't know how to make 'cjpeg-static'
Stop.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "cjpeg-static.exe" "cjpeg.exe"
The system cannot find the file specified.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>nmake.exe -nologo   "djpeg-static"
NMAKE : fatal error U1073: don't know how to make 'djpeg-static'
Stop.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "djpeg-static.exe" "djpeg.exe"
The system cannot find the file specified.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "j*.h" "C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\inc"
jchuff.h
jdcoefct.h
jdct.h
jdhuff.h
jdmainct.h
jdmaster.h
jdmerge.h
jdsample.h
jerror.h
jinclude.h
jmemsys.h
jmorecfg.h
jpegcomp.h
jpegint.h
jpeglib.h
jpeg_nbits_table.h
jsimd.h
jsimddct.h
       18 file(s) copied.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "libjpeg.lib" "C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\lib"
The system cannot find the file specified.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "cjpeg.exe" "C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\bin"
The system cannot find the file specified.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\libjpeg-turbo-2.1.4>copy /Y /B "djpeg.exe" "C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\bin"
The system cannot find the file specified.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build>if errorlevel 1 echo Build failed!   && exit /B 1
Build failed!
@infinitepower18 infinitepower18 changed the title Failed to build ARM64 dependencies Failed to build Windows ARM64 dependencies Oct 23, 2022
@nulano
Copy link
Contributor

nulano commented Oct 25, 2022

AFAIK none of the regular Pillow contributors have access to a Windows system running on ARM64, build support for that platform was added in #5811.

However, libjpeg-turbo is the first dependency to be built in the script, and the CMake error suggests your CMake is not configured properly. I would therefore suggest you check that you have the Visual Studio components for C++ build tools and a Windows SDK installed. From the CMake output it seems it is failing to find MSVCRTD.lib, which https://stackoverflow.com/a/55606007/1648883 suggests might require installing C++ libs.

@cgohlke
Copy link
Contributor

cgohlke commented Oct 25, 2022

AFAIK none of the regular Pillow contributors have access to a Windows system running on ARM64

I should have access to a "Windows Dev Kit 2023" soon and will try to build Pillow among other packages

@infinitepower18
Copy link
Author

AMD64 builds fine though. It's only ARM64 that ends up failing.

If you have access to an M1/M2 Mac you could also use that to install the ARM64 Windows 11 on Parallels or UTM and then run the ARM64 Python that way

@radarhere
Copy link
Member

Figured it out, installing MSVC v143 - VS 2022 C++ ARM64 build tools (Latest) via Visual Studio Installer appeared to have solved the problem.

You made this comment, but it's not appearing, so I imagine you deleted it. That didn't solve the problem after all?

@infinitepower18
Copy link
Author

infinitepower18 commented Oct 26, 2022

It did make some progress after installing that, but ended up failing at some point in the process:

https://gist.github.com/infinitepower18/e1190d4ba2a08bd5fa74f08d20499b7b

@nulano
Copy link
Contributor

nulano commented Oct 26, 2022

It did make some progress after installing that, but ended up failing at some point in the process:

https://gist.github.com/infinitepower18/e1190d4ba2a08bd5fa74f08d20499b7b

The error is triggered by libimagequant, but seems to be in a C++ standard library file:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xmmintrin.h(27): fatal error C1189: #error: This header is specific to X86, X64 and ARM64EC targets

I think this error should have been prevented by the commit ImageOptim/libimagequant@94adecb.

This makes me think that if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ARM64) is not true for your CMake for some reason, but that would probably be an issue between your CMake configuration and the libimagequant library not directly related to Pillow.

libimagequant is not required to build Pillow, you can skip it with: build_prepare.py --architecture=ARM64 --no-imagequant

@infinitepower18
Copy link
Author

This version of C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\fribidi-1.0.12\gen-unicode-version.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
NMAKE : fatal error U1077: '.\gen-unicode-version.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\ARM64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\ARM64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\ARM64\nmake.exe"' : return code '0x2'
Stop.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\fribidi-1.0.12>copy /Y /B "*.dll" "C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\bin"
*.dll
The system cannot find the file specified.
        0 file(s) copied.

C:\Users\Ahnaf\Desktop\Pillow\winbuild\build>if errorlevel 1 echo Build failed!   && exit /B 1
Build failed!

@nulano
Copy link
Contributor

nulano commented Oct 28, 2022

Oops, I thought I already replied two days ago...

This version of C:\Users\Ahnaf\Desktop\Pillow\winbuild\build\fribidi-1.0.12\gen-unicode-version.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

Are you actually running on an ARM64 system, or are you attempting to cross-compile?

Compiling FriBiDi requires compiling and running short programs to parse the Unicode specification and generate source code. These should be compiled for the host system, while the final DLL should be compiled for the target system. From the output I'm guessing these were compiled for ARM64 which cannot be run on your host system.

However, FriBiDi is also an optional dependency you can skip:
build_prepare.py --architecture=ARM64 --no-imagequant --no-fribidi

@infinitepower18
Copy link
Author

infinitepower18 commented Oct 28, 2022

I was doing it on a normal x64 system, but I do have Windows ARM64 running in a VM on my M1 Pro MacBook Pro. However after installing the required tools on Windows ARM64 I am back to the error that I initially reported. Which I don't get because I installed the ARM64 build tools as well. Not sure what I'm doing wrong here.

Screenshot 2022-10-29 at 12 19 54 am

@nulano
Copy link
Contributor

nulano commented Oct 28, 2022

Do you have a Windows 10 SDK installed as a VS2022 component on the ARM64 system?

BTW, FriBiDi is the last dependency, and optional, so you could just skip to running build_pillow.cmd bdist_wheel on the x86 system (where you got this error #6679 (comment)). The failed step is just to build fribidi.dll which is not needed for the wheel.

@nulano
Copy link
Contributor

nulano commented Oct 28, 2022

Just noting here for my future reference:

The x86_64 build tools should not be needed, but I suspect build_prepare.py will not detect Visual Studio without this component, even on ARM64:

"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",

This should probably end with ARM64 if compiling for ARM64.

It should probably also require Microsoft.VisualStudio.Component.Windows10SDK.

@cgohlke
Copy link
Contributor

cgohlke commented Oct 30, 2022

Good news. Besides the mentioned change in build_prepare.py, there are only two issues in dependencies:

  1. the liblzma solution is missing ARM64 target
  2. libopenjpeg ht_dec.c uses popcnt, which is not available on win-arm64.

Both issues are easy to fix/patch and the Pillow build succeeds and passes all tests besides the usual TestEmbeddable::test_embeddable failure (that test should be fixed or better removed).

============================= test session starts =============================
platform win32 -- Python 3.11.0, pytest-7.2.0, pluggy-1.0.0
--------------------------------------------------------------------
Pillow 9.3.0
Python 3.11.0 (main, Oct 24 2022, 18:15:22) [MSC v.1933 64 bit (ARM64)]
--------------------------------------------------------------------
Python modules loaded from C:\Python311-arm64\Lib\site-packages\PIL
Binary modules loaded from C:\Python311-arm64\Lib\site-packages\PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 9.3.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.12.1
--- LITTLECMS2 support ok, loaded 2.13.1
--- WEBP support ok, loaded 1.2.4
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 2.1.4
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.0
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.13
--- LIBTIFF support ok, loaded 4.4.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
*** XCB (X protocol) support not installed
--------------------------------------------------------------------

rootdir: C:\Build\Pillow\Pillow-9.3.0.git, configfile: setup.cfg
plugins: cov-4.0.0, timeout-2.1.0
collected 2949 items / 1 skipped

Tests\test_000_sanity.py .                                               [  0%]
Tests\test_binary.py ...                                                 [  0%]
Tests\test_bmp_reference.py ...                                          [  0%]
Tests\test_box_blur.py ..............                                    [  0%]
Tests\test_color_lut.py ..........................                       [  1%]
Tests\test_core_resources.py ..............                              [  2%]
Tests\test_decompression_bomb.py ..........                              [  2%]
Tests\test_deprecate.py ..........                                       [  2%]
Tests\test_deprecated_imageqt.py .                                       [  2%]
Tests\test_features.py ......s..............                             [  3%]
Tests\test_file_apng.py ................................                 [  4%]
Tests\test_file_blp.py .............                                     [  5%]
Tests\test_file_bmp.py ..................                                [  5%]
Tests\test_file_bufrstub.py .....                                        [  5%]
Tests\test_file_container.py ...............                             [  6%]
Tests\test_file_cur.py ..                                                [  6%]
Tests\test_file_dcx.py .........                                         [  6%]
Tests\test_file_dds.py ...........................                       [  7%]
Tests\test_file_eps.py ss.sssss..sssssss......s.                         [  8%]
Tests\test_file_fits.py .....                                            [  8%]
Tests\test_file_fli.py ...............                                   [  9%]
Tests\test_file_fpx.py ...                                               [  9%]
Tests\test_file_ftex.py ....                                             [  9%]
Tests\test_file_gbr.py ....                                              [  9%]
Tests\test_file_gd.py ...                                                [  9%]
Tests\test_file_gif.py ......................ss......................... [ 11%]
................................                                         [ 12%]
Tests\test_file_gimpgradient.py ..........                               [ 12%]
Tests\test_file_gimppalette.py ..                                        [ 12%]
Tests\test_file_gribstub.py .....                                        [ 12%]
Tests\test_file_hdf5stub.py .....                                        [ 13%]
Tests\test_file_icns.py ...........                                      [ 13%]
Tests\test_file_ico.py ...................                               [ 14%]
Tests\test_file_im.py ...............                                    [ 14%]
Tests\test_file_imt.py ....                                              [ 14%]
Tests\test_file_iptc.py .....                                            [ 14%]
Tests\test_file_jpeg.py ................................................ [ 16%]
..ss..................................                                   [ 17%]
Tests\test_file_jpeg2k.py ...........................................sss [ 19%]
s....                                                                    [ 19%]
Tests\test_file_libtiff.py ............................................. [ 21%]
.......................................                                  [ 22%]
Tests\test_file_libtiff_small.py ...                                     [ 22%]
Tests\test_file_mcidas.py ..                                             [ 22%]
Tests\test_file_mic.py ......                                            [ 22%]
Tests\test_file_mpo.py .............................                     [ 23%]
Tests\test_file_msp.py ....ss.                                           [ 24%]
Tests\test_file_palm.py .X..                                             [ 24%]
Tests\test_file_pcd.py .                                                 [ 24%]
Tests\test_file_pcx.py ................                                  [ 24%]
Tests\test_file_pdf.py ................                                  [ 25%]
Tests\test_file_pixar.py ..                                              [ 25%]
Tests\test_file_png.py ................................................. [ 26%]
........s                                                                [ 27%]
Tests\test_file_ppm.py .....................................             [ 28%]
Tests\test_file_psd.py ..................                                [ 29%]
Tests\test_file_sgi.py ..........                                        [ 29%]
Tests\test_file_spider.py ................                               [ 30%]
Tests\test_file_sun.py ..s                                               [ 30%]
Tests\test_file_tar.py ....                                              [ 30%]
Tests\test_file_tga.py ..................                                [ 30%]
Tests\test_file_tiff.py ................................................ [ 32%]
..............................s...                                       [ 33%]
Tests\test_file_tiff_metadata.py ......................                  [ 34%]
Tests\test_file_wal.py ..                                                [ 34%]
Tests\test_file_webp.py ....................                             [ 35%]
Tests\test_file_webp_alpha.py ....                                       [ 35%]
Tests\test_file_webp_animated.py ......                                  [ 35%]
Tests\test_file_webp_lossless.py .                                       [ 35%]
Tests\test_file_webp_metadata.py .......                                 [ 35%]
Tests\test_file_wmf.py .......                                           [ 36%]
Tests\test_file_xbm.py ......                                            [ 36%]
Tests\test_file_xpm.py ...                                               [ 36%]
Tests\test_file_xvthumb.py ...                                           [ 36%]
Tests\test_font_bdf.py ..                                                [ 36%]
Tests\test_font_leaks.py ss                                              [ 36%]
Tests\test_font_pcf.py ......                                            [ 36%]
Tests\test_font_pcf_charsets.py .........                                [ 37%]
Tests\test_format_hsv.py ....                                            [ 37%]
Tests\test_format_lab.py ...                                             [ 37%]
Tests\test_image.py ........................................s........... [ 39%]
....................................................                     [ 40%]
Tests\test_image_access.py ............................................. [ 42%]
.........................F                                               [ 43%]
Tests\test_image_array.py ...                                            [ 43%]
Tests\test_image_convert.py .............................                [ 44%]
Tests\test_image_copy.py .......                                         [ 44%]
Tests\test_image_crop.py .............                                   [ 44%]
Tests\test_image_draft.py ...                                            [ 45%]
Tests\test_image_entropy.py .                                            [ 45%]
Tests\test_image_filter.py ............................................. [ 46%]
.........................................                                [ 48%]
Tests\test_image_frombytes.py .                                          [ 48%]
Tests\test_image_fromqimage.py sssss                                     [ 48%]
Tests\test_image_getbands.py .                                           [ 48%]
Tests\test_image_getbbox.py ..                                           [ 48%]
Tests\test_image_getcolors.py ..                                         [ 48%]
Tests\test_image_getdata.py ..                                           [ 48%]
Tests\test_image_getextrema.py ..                                        [ 48%]
Tests\test_image_getim.py .                                              [ 48%]
Tests\test_image_getpalette.py ..                                        [ 48%]
Tests\test_image_getprojection.py .                                      [ 48%]
Tests\test_image_histogram.py .                                          [ 48%]
Tests\test_image_load.py .....                                           [ 48%]
Tests\test_image_mode.py ..                                              [ 48%]
Tests\test_image_paste.py ..................................             [ 50%]
Tests\test_image_point.py .....                                          [ 50%]
Tests\test_image_putalpha.py ...                                         [ 50%]
Tests\test_image_putdata.py .........                                    [ 50%]
Tests\test_image_putpalette.py .....                                     [ 50%]
Tests\test_image_quantize.py .s.............                             [ 51%]
Tests\test_image_reduce.py ............................................. [ 52%]
........................................................................ [ 55%]
........................................................................ [ 57%]
....................                                                     [ 58%]
Tests\test_image_resample.py ........................................... [ 59%]
....xx...................................                                [ 61%]
Tests\test_image_resize.py ............................................. [ 62%]
................................                                         [ 63%]
Tests\test_image_rotate.py ..........................                    [ 64%]
Tests\test_image_split.py ...........                                    [ 65%]
Tests\test_image_thumbnail.py ..........                                 [ 65%]
Tests\test_image_tobitmap.py .                                           [ 65%]
Tests\test_image_tobytes.py .                                            [ 65%]
Tests\test_image_transform.py .......................................... [ 67%]
.................................                                        [ 68%]
Tests\test_image_transpose.py ........................................   [ 69%]
Tests\test_imagechops.py ..............................                  [ 70%]
Tests\test_imagecms.py ...............................                   [ 71%]
Tests\test_imagecolor.py .....                                           [ 71%]
Tests\test_imagedraw.py ................................................ [ 73%]
......................................s................................. [ 75%]
                                                                         [ 75%]
Tests\test_imagedraw2.py ................                                [ 76%]
Tests\test_imageenhance.py ......                                        [ 76%]
Tests\test_imagefile.py .........................                        [ 77%]
Tests\test_imagefont.py ................................................ [ 79%]
.........................................sssssssssssssssssssssssssssssss [ 81%]
sssssssssssssssssssssssssssssssssssssssssssssssssssssssss....ss......    [ 83%]
Tests\test_imagefontctl.py sssssssssssssssssssssssssssssssssssssssssssss [ 85%]
sssssssssssssssssssssssssssssssssss                                      [ 86%]
Tests\test_imagegrab.py .s.s...                                          [ 86%]
Tests\test_imagemath.py .........................                        [ 87%]
Tests\test_imagemorph.py .......................                         [ 88%]
Tests\test_imageops.py ............................                      [ 89%]
Tests\test_imageops_usm.py .....                                         [ 89%]
Tests\test_imagepalette.py ...............                               [ 89%]
Tests\test_imagepath.py .............                                    [ 90%]
Tests\test_imageqt.py sss                                                [ 90%]
Tests\test_imagesequence.py ........                                     [ 90%]
Tests\test_imageshow.py ....sssss...ss                                   [ 91%]
Tests\test_imagestat.py ...                                              [ 91%]
Tests\test_imagetk.py ..............                                     [ 91%]
Tests\test_imagewin.py ........                                          [ 92%]
Tests\test_imagewin_pointers.py .                                        [ 92%]
Tests\test_lib_image.py .                                                [ 92%]
Tests\test_lib_pack.py ....................................              [ 93%]
Tests\test_locale.py .                                                   [ 93%]
Tests\test_main.py .                                                     [ 93%]
Tests\test_map.py ...                                                    [ 93%]
Tests\test_mode_i16.py .......                                           [ 93%]
Tests\test_numpy.py ...................................                  [ 95%]
Tests\test_pdfparser.py ....                                             [ 95%]
Tests\test_pickle.py ................................................... [ 96%]
.........................................                                [ 98%]
Tests\test_psdraw.py ...                                                 [ 98%]
Tests\test_pyroma.py .                                                   [ 98%]
Tests\test_qt_image_qapplication.py s                                    [ 98%]
Tests\test_qt_image_toqimage.py sssss                                    [ 98%]
Tests\test_sgi_crash.py ...........                                      [ 98%]
Tests\test_shell_injection.py ssss                                       [ 99%]
Tests\test_tiff_crashes.py ss...........s.                               [ 99%]
Tests\test_tiff_ifdrational.py ....                                      [ 99%]
Tests\test_util.py ......                                                [ 99%]
Tests\test_webp_leaks.py s                                               [100%]

================================== FAILURES ===================================
_______________________ TestEmbeddable.test_embeddable ________________________
<snip>
C:\Python311-arm64\Lib\site-packages\setuptools\_distutils\_msvccompiler.py:514: LinkError
---------------------------- Captured stdout call -----------------------------
embed_pil.c
embed_pil.c(8): warning C4996: 'Py_SetPythonHome': deprecated in 3.11
LINK : fatal error LNK1104: cannot open file 'python311.lib'
=========================== short test summary info ===========================
SKIPPED [1] Tests\oss-fuzz\test_fuzzers.py:11: Fuzzer is linux only
SKIPPED [1] Tests\test_features.py:68: libimagequant not available
SKIPPED [1] Tests\test_file_eps.py:32: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:61: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:77: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:97: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:108: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:119: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:127: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:153: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:175: Ghostscript not available
SKIPPED [3] Tests\test_file_eps.py:197: Ghostscript not available
SKIPPED [2] Tests\test_file_eps.py:206: Ghostscript not available
SKIPPED [1] Tests\test_file_eps.py:274: Ghostscript not available
SKIPPED [1] Tests\test_file_gif.py:337: Netpbm not available
SKIPPED [1] Tests\test_file_gif.py:348: Netpbm not available
SKIPPED [1] Tests\test_file_jpeg.py:610: djpeg not available
SKIPPED [1] Tests\test_file_jpeg.py:616: cjpeg not available
SKIPPED [4] Tests\test_file_jpeg2k.py:323: Extra image files not installed
SKIPPED [1] Tests\test_file_msp.py:58: Extra image files not installed
SKIPPED [1] Tests\test_file_msp.py:72: Even More Extra image files not installed
SKIPPED [1] Tests\test_file_png.py:781: Requires Unix or macOS
SKIPPED [1] Tests\test_file_sun.py:35: Extra image files not installed
SKIPPED [1] Tests\test_file_tiff.py:840: Extra image files not installed
SKIPPED [1] Tests\test_font_leaks.py:20: Requires Unix or macOS
SKIPPED [1] Tests\test_font_leaks.py:31: Requires Unix or macOS
SKIPPED [1] Tests\test_image.py:204: Test requires opening tempfile twice
SKIPPED [1] Tests\test_image_fromqimage.py:44: Qt bindings are not installed
SKIPPED [1] Tests\test_image_fromqimage.py:49: Qt bindings are not installed
SKIPPED [1] Tests\test_image_fromqimage.py:54: Qt bindings are not installed
SKIPPED [1] Tests\test_image_fromqimage.py:59: Qt bindings are not installed
SKIPPED [1] Tests\test_image_fromqimage.py:64: Qt bindings are not installed
SKIPPED [1] Tests\test_image_quantize.py:21: libimagequant not available
SKIPPED [1] Tests\test_imagedraw.py:970: failing
SKIPPED [1] Tests\test_imagefont.py:51: raqm not available
SKIPPED [1] Tests\test_imagefont.py:79: raqm not available
SKIPPED [1] Tests\test_imagefont.py:83: raqm not available
SKIPPED [1] Tests\test_imagefont.py:101: raqm not available
SKIPPED [1] Tests\test_imagefont.py:106: raqm not available
SKIPPED [1] Tests\test_imagefont.py:115: raqm not available
SKIPPED [1] Tests\test_imagefont.py:125: raqm not available
SKIPPED [1] Tests\test_imagefont.py:139: raqm not available
SKIPPED [1] Tests\test_imagefont.py:150: raqm not available
SKIPPED [6] Tests\test_imagefont.py:162: raqm not available
SKIPPED [1] Tests\test_imagefont.py:194: raqm not available
SKIPPED [1] Tests\test_imagefont.py:210: raqm not available
SKIPPED [3] Tests\test_imagefont.py:227: raqm not available
SKIPPED [1] Tests\test_imagefont.py:238: raqm not available
SKIPPED [1] Tests\test_imagefont.py:247: raqm not available
SKIPPED [1] Tests\test_imagefont.py:254: raqm not available
SKIPPED [1] Tests\test_imagefont.py:275: raqm not available
SKIPPED [1] Tests\test_imagefont.py:293: raqm not available
SKIPPED [1] Tests\test_imagefont.py:309: raqm not available
SKIPPED [2] Tests\test_imagefont.py:317: raqm not available
SKIPPED [4] Tests\test_imagefont.py:357: raqm not available
SKIPPED [2] Tests\test_imagefont.py:401: raqm not available
SKIPPED [4] Tests\test_imagefont.py:416: raqm not available
SKIPPED [1] Tests\test_imagefont.py:437: raqm not available
SKIPPED [1] Tests\test_imagefont.py:441: raqm not available
SKIPPED [1] Tests\test_imagefont.py:449: raqm not available
SKIPPED [1] Tests\test_imagefont.py:462: raqm not available
SKIPPED [1] Tests\test_imagefont.py:504: raqm not available
SKIPPED [1] Tests\test_imagefont.py:509: raqm not available
SKIPPED [1] Tests\test_imagefont.py:527: raqm not available
SKIPPED [1] Tests\test_imagefont.py:602: raqm not available
SKIPPED [2] Tests\test_imagefont.py:635: raqm not available
SKIPPED [1] Tests\test_imagefont.py:665: raqm not available
SKIPPED [1] Tests\test_imagefont.py:735: raqm not available
SKIPPED [1] Tests\test_imagefont.py:760: raqm not available
SKIPPED [8] Tests\test_imagefont.py:790: raqm not available
SKIPPED [11] Tests\test_imagefont.py:832: raqm not available
SKIPPED [1] Tests\test_imagefont.py:869: raqm not available
SKIPPED [4] Tests\test_imagefont.py:896: raqm not available
SKIPPED [1] Tests\test_imagefont.py:914: raqm not available
SKIPPED [1] Tests\test_imagefont.py:931: raqm not available
SKIPPED [3] Tests\test_imagefont.py:943: raqm not available
SKIPPED [1] Tests\test_imagefont.py:966: raqm not available
SKIPPED [1] Tests\test_imagefont.py:983: raqm not available
SKIPPED [1] Tests\test_imagefont.py:1002: raqm not available
SKIPPED [1] Tests\test_imagefont.py:1019: raqm not available
SKIPPED [1] Tests\test_imagefont.py:1036: raqm not available
SKIPPED [1] Tests\test_imagefont.py:1052: raqm not available
SKIPPED [1] Tests\test_imagefont.py:1068: raqm not available
SKIPPED [1] Tests\test_imagefont.py:1087: raqm not available
SKIPPED [2] Tests\test_imagefont.py:545: requires Unix or macOS
SKIPPED [1] Tests\test_imagefontctl.py:13: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:21: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:32: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:43: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:63: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:74: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:85: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:96: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:111: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:134: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:147: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:158: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:175: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:186: raqm not available
SKIPPED [10] Tests\test_imagefontctl.py:197: raqm not available
SKIPPED [16] Tests\test_imagefontctl.py:224: raqm not available
SKIPPED [4] Tests\test_imagefontctl.py:250: raqm not available
SKIPPED [26] Tests\test_imagefontctl.py:304: raqm not available
SKIPPED [9] Tests\test_imagefontctl.py:324: raqm not available
SKIPPED [1] Tests\test_imagefontctl.py:356: raqm not available
SKIPPED [1] Tests\test_imagegrab.py:24: xcb not available
SKIPPED [1] Tests\test_imagegrab.py:45: xcb not available
SKIPPED [1] Tests\test_imageqt.py:20: Qt bindings are not installed
SKIPPED [1] Tests\test_imageqt.py:49: Qt bindings are not installed
SKIPPED [1] Tests\test_imageqt.py:63: Qt bindings are not installed
SKIPPED [5] Tests\test_imageshow.py:44: Only run on CIs; hangs on Windows CIs
SKIPPED [1] Tests\test_imageshow.py:82: IPython not installed
SKIPPED [1] Tests\test_imageshow.py:94: Only run on CIs; hangs on Windows CIs
SKIPPED [1] Tests\test_qt_image_qapplication.py:54: Qt bindings are not installed
SKIPPED [5] Tests\test_qt_image_toqimage.py:19: Qt bindings are not installed
SKIPPED [1] Tests\test_shell_injection.py:25: djpeg not available
SKIPPED [1] Tests\test_shell_injection.py:34: cjpeg not available
SKIPPED [1] Tests\test_shell_injection.py:39: Netpbm not available
SKIPPED [1] Tests\test_shell_injection.py:45: Netpbm not available
SKIPPED [3] Tests\test_tiff_crashes.py:50: test image not found
SKIPPED [1] Tests\test_webp_leaks.py:16: Requires Unix or macOS
XFAIL Tests/test_image_resample.py::TestCoreResampleAlphaCorrect::test_levels_rgba - Current implementation isn't precise enough
XFAIL Tests/test_image_resample.py::TestCoreResampleAlphaCorrect::test_levels_la - Current implementation isn't precise enough
XPASS Tests/test_file_palm.py::test_p_mode Palm P image is wrong
FAILED Tests/test_image_access.py::TestEmbeddable::test_embeddable - distutils.errors.LinkError: command 'C:\\Program Files\\Microsoft Visual St...
===== 1 failed, 2710 passed, 236 skipped, 2 xfailed, 1 xpassed in 38.27s ======

Here's the wheel:
Pillow-9.3.0-cp311-cp311-win_arm64.whl.zip

@nulano
Copy link
Contributor

nulano commented Oct 30, 2022

  1. the liblzma solution is missing ARM64 target

That was just added to build_prepare.py in #6562.
I see there is also a CMake build that might work instead; I do not recall why I chose the VS build.

  1. libopenjpeg ht_dec.c uses popcnt, which is not available on win-arm64.

Already fixed in a future release: uclouvain/openjpeg#1422

Having an ARM64 Windows CI would have quickly caught both of those issues.

passes all tests besides the usual TestEmbeddable::test_embeddable failure (that test should be fixed or better removed).

I've created #6703 to mark it as "known failing". It will still get run, but will no longer mark the pytest session as a fail.

@cgohlke
Copy link
Contributor

cgohlke commented Oct 30, 2022

I've created #6703 to mark it as "known failing"

Another issue with that test is that it leaves temporary files (obj and exe) behind. Probably better to remove the test altogether if it doesn't get maintained.

@kmilos
Copy link
Contributor

kmilos commented Nov 3, 2022

Having an ARM64 Windows CI

One can only hope these will make it to GitHub as well... In the meantime, a self-hosted runner using the "Windows Dev Kit 2023" is the only option (see e.g. the MSYS2 one using the older kit).

@radarhere
Copy link
Member

#6703 has been merged.

Is the only thing left outstanding here the OpenJPEG issue? I've created PR #6718 to patch it until the next version of OpenJPEG is released.

@radarhere
Copy link
Member

Here is a Windows arm wheel for Pillow 9.4.0 - #6750 (comment)

@nulano
Copy link
Contributor

nulano commented Nov 16, 2023

I've attempted to compile Pillow on a borrowed MacBook running Windows on ARM in a VM and got the same error message. It turns out I was missing the following Visual Studio Build Tools components:

  • C++ Modules for v143 build tools (ARM64 - experimental)
  • MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)

These correspond to the following IDs according to https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022&preserve-view=true:

Microsoft.VisualStudio.Component.VC.Modules.ARM64
Microsoft.VisualStudio.Component.VC.Tools.ARM64

Without these components, the build tools were silently selecting the x86 compiler and linker instead.

Installing those components and trying again fixed the issue for me.

Interestingly, the former component (i.e. C++ modules) is only needed in the Visual Studio Build Tools edition, the Community edition does not list or require this component at all.

I've created #7559 to fix the Visual Studio component check as well as some cross-compilation errors.

@radarhere
Copy link
Member

radarhere commented Feb 28, 2024

Is the only thing left outstanding here the OpenJPEG issue? I've created PR #6718 to patch it until the next version of OpenJPEG is released.

A new version of OpenJPEG has been released, and I've created #7837 to remove the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants