indygreg / python-build-standalone

Produce redistributable builds of Python
Mozilla Public License 2.0
2.13k stars 133 forks source link

Add ARM64 builds for Windows #387

Open zanieb opened 3 weeks ago

zanieb commented 3 weeks ago

Picking up https://github.com/indygreg/python-build-standalone/pull/93

zanieb commented 3 weeks ago

We're failing missing applink.c:


cpython>     38>ClCompile:
cpython>          C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\bin\HostX64\arm64\CL.exe /c /I"C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\openssl\arm64\include" /I"C:\Users\runneradmin\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\Include" /I"C:\Users\runneradmin\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\Include\internal" /I"C:\Users\runneradmin\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\Include\internal\mimalloc" /I"C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\PCbuild\obj\\313arm64_PGInstrument\pythoncore\\" /I"C:\Users\runneradmin\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\PC" /Zi /nologo /W3 /WX- /diagnostics:column /MP /O2 /Oi /Oy- /GL /D _CRT_SECURE_NO_WARNINGS /GF /Gm- /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\PCbuild\obj\313arm64_PGInstrument\_ssl\\" /Fd"C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\PCbuild\obj\313arm64_PGInstrument\_ssl\vc143.pdb" /external:W3 /Gd /TC /analyze- /FC /errorReport:queue /utf-8 "C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\openssl\arm64\include\openssl\applink.c"
cpython>          applink.c
cpython>     38>C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\openssl\arm64\include\openssl\applink.c(1,1): error C1083: Cannot open source file: 'C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\openssl\arm64\include\openssl\applink.c': No such file or directory [C:\Users\RUNNER~1\AppData\Local\Temp\python-build-3k85bya8\Python-3.13.0\PCbuild\_ssl.vcxproj]
cpython>          (compiling source file '../../../../../../../RUNNER~1/AppData/Local/Temp/python-build-3k85bya8/openssl/arm64/include/openssl/applink.c')

on amd64, you can see we copy this file

openssl> *** Installing runtime libraries
openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install'
openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64'
openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/bin'
openssl> Copying: libcrypto-1_1-x64.dll to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/bin/libcrypto-1_1-x64.dll
openssl> Copying: libssl-1_1-x64.dll to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/bin/libssl-1_1-x64.dll
openssl> Copying: libcrypto-1_1-x64.pdb to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/bin/libcrypto-1_1-x64.pdb
openssl> Copying: libssl-1_1-x64.pdb to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/bin/libssl-1_1-x64.pdb
openssl> *** Installing development files
openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/include'
openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/include/openssl'
openssl> Copying: ./ms/applink.c to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-upok1jaj/x64/install/64/include/openssl/applink.c

but we don't on arm64

2024-10-30T14:25:05.2679998Z openssl> *** Installing runtime libraries
2024-10-30T14:25:05.2957214Z openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install'
2024-10-30T14:25:05.2959360Z openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64'
2024-10-30T14:25:05.2961110Z openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/bin'
2024-10-30T14:25:05.3572257Z openssl> Copying: libcrypto-3-arm64.dll to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/bin/libcrypto-3-arm64.dll
2024-10-30T14:25:05.3574146Z openssl> Copying: libssl-3-arm64.dll to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/bin/libssl-3-arm64.dll
2024-10-30T14:25:05.4293375Z openssl> Copying: libcrypto-3-arm64.pdb to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/bin/libcrypto-3-arm64.pdb
2024-10-30T14:25:05.4295870Z openssl> Copying: libssl-3-arm64.pdb to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/bin/libssl-3-arm64.pdb
2024-10-30T14:25:05.4709900Z openssl> *** Installing development files
2024-10-30T14:25:05.4964299Z openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/include'
2024-10-30T14:25:05.4966851Z openssl> created directory `C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/include/openssl'
2024-10-30T14:25:05.5798950Z openssl> Copying: ./include/openssl/aes.h to C:/Users/RUNNER~1/AppData/Local/Temp/openssl-build-hynbk0h3/arm64/install/arm64/include/openssl/aes.h

Looks like -D"OPENSSL_USE_APPLINK" is set on amd64 but not arm64

zanieb commented 3 weeks ago

By manually copying the applink.c file, we make it to

2024-10-30T17:22:46.9472354Z Traceback (most recent call last):
2024-10-30T17:22:46.9481385Z   File "D:\a\python-build-standalone\python-build-standalone\cpython-windows\build.py", line 2046, in <module>
2024-10-30T17:22:46.9482543Z     sys.exit(main())
2024-10-30T17:22:46.9483423Z   File "D:\a\python-build-standalone\python-build-standalone\cpython-windows\build.py", line 2010, in main
2024-10-30T17:22:46.9484169Z     tar_path = build_cpython(
2024-10-30T17:22:46.9485025Z   File "D:\a\python-build-standalone\python-build-standalone\cpython-windows\build.py", line 1596, in build_cpython
2024-10-30T17:22:46.9486058Z     tests = subprocess.run(
2024-10-30T17:22:46.9486654Z   File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 505, in run
2024-10-30T17:22:46.9488654Z     with Popen(*popenargs, **kwargs) as process:
2024-10-30T17:22:46.9489422Z   File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 951, in __init__
2024-10-30T17:22:46.9491810Z     self._execute_child(args, executable, preexec_fn, close_fds,
2024-10-30T17:22:46.9492618Z   File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 1420, in _execute_child
2024-10-30T17:22:46.9495394Z     hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
2024-10-30T17:22:46.9496711Z OSError: [WinError 216] This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher
2024-10-30T17:22:46.9845209Z ##[error]Process completed with exit code 1.

Where we fail to run the PGO tests because, of course, we're not on an ARM runner.

https://github.com/indygreg/python-build-standalone/blob/00ea84cd2a525c8d20566482633903878bae2996/cpython-windows/build.py#L1596-L1602

zanieb commented 3 weeks ago

I don't really know what the plan is here. There aren't public ARM Windows runners (though they might be eventually https://github.com/actions/runner-images/issues/10820 / https://github.com/github/roadmap/issues/970). We (Astral) could pay for runners, but I can't set that up in this repository.

We could skip PGO, but we're still going to fail later (we need to invoke python.exe for various things).