PyO3 / maturin-action

GitHub Action to install and run a custom maturin command with built-in support for cross compilation
MIT License
127 stars 35 forks source link

build failing for windows aarch64 #237

Closed samuelcolvin closed 9 months ago

samuelcolvin commented 9 months ago

See this build of rtoml, PR https://github.com/samuelcolvin/rtoml/pull/70.

Build is failing with

error: linking with `lld-link` failed: exit code: 1
  |
  = note: "lld-link" "-flavor" "link" "/DEF:C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcaDDT9t\\lib.def" "/NOLOGO" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcaDDT9t\\symbols.o" "D:\\a\\rtoml\\rtoml\\target\\aarch64-pc-windows-msvc\\release\\deps\\_rtoml._rtoml.9e9c41c9a5c02f73-cgu.0.rcgu.o" "/LIBPATH:D:\\a\\rtoml\\rtoml\\target\\aarch64-pc-windows-msvc\\release\\deps" "/LIBPATH:D:\\a\\rtoml\\rtoml\\target\\release\\deps" "/LIBPATH:C:\\Users\\runneradmin\\AppData\\Local\\cargo-xwin\\xwin/crt/lib/aarch64" "/LIBPATH:C:\\Users\\runneradmin\\AppData\\Local\\cargo-xwin\\xwin/sdk/lib/um/aarch64" "/LIBPATH:C:\\Users\\runneradmin\\AppData\\Local\\cargo-xwin\\xwin/sdk/lib/ucrt/aarch64" "/LIBPATH:C:\\Users\\runneradmin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_aarch64_msvc-0.36.1\\lib" "/LIBPATH:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib\\libcompiler_builtins-0c1ccdad0dc8a8b0.rlib" "bcrypt.lib" "windows.lib" "python311.lib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib" "/OUT:D:\\a\\rtoml\\rtoml\\target\\aarch64-pc-windows-msvc\\release\\deps\\_rtoml.dll" "/OPT:REF,ICF" "/DLL" "/IMPLIB:D:\\a\\rtoml\\rtoml\\target\\aarch64-pc-windows-msvc\\release\\deps\\_rtoml.dll.lib" "/DEBUG" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: lld-link: error: could not open 'python311.lib': no such file or directory

error: could not compile `rtoml` (lib) due to previous error
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit code: 101": `"cargo" "rustc" "--features" "pyo3/extension-module" "--target" "aarch64-pc-windows-msvc" "--message-format" "json-render-diagnostics" "--manifest-path" "D:\\a\\rtoml\\rtoml\\Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`
Error: The process 'D:\a\_temp\88417d27-821c-4689-97b5-d684a626f3f0\maturin.exe' failed with exit code 1
    at ExecState._setResult (D:\a\_actions\PyO3\maturin-action\v1\dist\index.js:1702:25)
    at ExecState.CheckComplete (D:\a\_actions\PyO3\maturin-action\v1\dist\index.js:1685:18)
    at ChildProcess.<anonymous> (D:\a\_actions\PyO3\maturin-action\v1\dist\index.js:1579:27)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
Error: The process 'D:\a\_temp\88417d27-821c-4689-97b5-d684a626f3f0\maturin.exe' failed with exit code 1

build settings:

          - os: windows
            target: aarch64
            interpreter: 3.11 3.12

I'm going to comment out this case to get a release out.

cc @davidhewitt.

messense commented 9 months ago

You need to enable the pyo3/generate-import-lib feature to allow cross compiling to aarch64 Windows.