scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Add build support for Windows on ARM64 (based on llvm-mingw)

Open ZIXT233 opened this issue 2 years ago • 9 comments

I tried to cross compile scrcpy for win on arm64 using llvm-mingw, which seems to be working properly and significantly improves video performance in win on arm64.

What I did:

  • Prebuilt libusb,ffmpeg,SDL2 for win on arm64, which was placed in my responsitories. (Removed libusb build flags "-mwin32" and "--add-stdcall-alias" to support llvm)
  • Added scripts to get prebuilt-deps.
  • Added win on arm64 build option in release.mk, which should be manually specified as llvm-mingw is a special toolchain. In addtion, I removed the linker option "-Wl,--allow-shlib-undefined" unsupported by llvm in build.ninja after meson completed. (There seems to be no way to prevent meson from passing this option so far, see: https://github.com/mesonbuild/meson/issues/7506 )
  • Modified app/build.ninja to select libusb dll depending on host_machine.cpu_family().

Known issue:

  • Reported error "couldn't find image decorder" and "couldn't load icon" when starting. 36F3D3382058CE4FCE21E4AEB551C50B

I'm not sure where to put the prebuilt package to ensure its maintenance . Let me know if there are any problems.

ZIXT233 avatar May 09 '22 02:05 ZIXT233

Thank you for your work.

The "prebuilt" mechanism of scrcpy is quite rudimentary (it downloads prebuilt releases). This can be a limitation (we could not patch dependencies as necessary), but in practice it "works".

However, this is acceptable only if the prebuilt binaries are "official" (e.g. linked from the official website of the dependency). It could not depend on binaries from random repositories. I understand that official binaries do not exist for ARM64 (so you did build them by yourself), but it is a problem to depend on https://github.com/ZIXT233/. :disappointed:

rom1v avatar May 10 '22 06:05 rom1v

It is feasible to build dependencies from the official code. Maybe I can modify the script to support it? @rom1v

ZIXT233 avatar May 10 '22 11:05 ZIXT233

@ZIXT233 Please read the discussion in #1753 first :)

It would be great to (optionally) build (from Linux) the dependencies (SDL, FFmpeg, libusb, adb), but still be able to use either the official prebuilt or the existing package already installed, if any. After that, yes, we could add the scripts/options to cross-build for Windows-arm64.

rom1v avatar May 10 '22 11:05 rom1v

@rom1v So are you considering adding optional deps dynamic building scripts/options for more common situation?

ZIXT233 avatar May 10 '22 13:05 ZIXT233

Separate scripts to build the dependencies when requested (similar to the contribs in vlc), so that the resulting binaries could be used to build scrcpy, would be great, yes.

rom1v avatar May 10 '22 18:05 rom1v

I'll try it. It may take some time to design.

ZIXT233 avatar May 12 '22 01:05 ZIXT233

I started a skeleton: #3283

rom1v avatar May 21 '22 12:05 rom1v

We'd like to fix this properly in libusb: https://github.com/libusb/libusb/issues/1192

tormodvolden avatar Sep 04 '22 08:09 tormodvolden

I would like to cross-compile scrcpy application for ARM-32bit architecture. does it support ARM Platform ?

srinya avatar Sep 12 '22 15:09 srinya