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

Please provide OS X binaries #1733

Closed
alexhelder opened this issue Sep 3, 2020 · 31 comments
Closed

Please provide OS X binaries #1733

alexhelder opened this issue Sep 3, 2020 · 31 comments

Comments

@alexhelder
Copy link

alexhelder commented Sep 3, 2020

Not everyone with OS X can run homebrew. For example, enterprise management software may block homebrew.

@rom1v
Copy link
Collaborator

rom1v commented Sep 4, 2020

It would be great if there was an option to build scrcpy statically (with relevant parts of ffmpeg and sdl included). (#1624)

This would be easier to distribute a binary for other platforms.

@walkthunder
Copy link

walkthunder commented Feb 13, 2021

Anybody working on this issue? Really need it.

@walkthunder
Copy link

walkthunder commented Feb 16, 2021

I wanna work it out, but I'm not familar with the build system.
So could you pls give me some hints, like:

how to prepare the dependencies(ffmpeg).

would this be helpful? https://gitlab.freedesktop.org/gstreamer/gst-build/-/blob/master/subprojects/FFmpeg.wrap
I can see It generates each library's pkg_config file, inside it's meson.build

This way pkg_config knows where to find libavcodec/libavformat/.etc when building scrcpy.

would that work? @rom1v
or what else need to be noticed?

@Biswa96
Copy link
Contributor

Biswa96 commented Feb 16, 2021

I am not familiar with macOS but will this work https://formulae.brew.sh/formula/ffmpeg?

@walkthunder
Copy link

@Biswa96 In this way ffmpeg linked as shared library. But here we need a static version of libavformat/libavcodec instead of dylibs.

And some related header files are also necessary, with which we can declare dependencies.

@Genxster1998
Copy link
Contributor

+1 , its really ridicules to install 1GB+ source setup and other system overheads to use scrcpy on MacOS using brew . I don't know how it got popular even though it pulls Gigabytes to just update its database .

@rom1v
Copy link
Collaborator

rom1v commented Jan 7, 2022

https://github.com/Genymobile/scrcpy#macos
Is it the same with MacPorts?

@Genxster1998
Copy link
Contributor

Genxster1998 commented Jan 8, 2022

https://github.com/Genymobile/scrcpy#macos Is it the same with MacPorts?

On macports , macports default base installation size. is 500MB.
On executing sudo port install scrcpy

--->  Computing dependencies for scrcpy
The following dependencies will be installed:
 Xft2
 XviD
 android-platform-tools
 aom
 autoconf
 autoconf-archive
 automake
 brotli
 bzip2
 cairo
 curl-ca-bundle
 dav1d
 db48
 expat
 ffmpeg
 fontconfig
 freetype
 fribidi
 gd2
 gdbm
 gdk-pixbuf2
 gettext
 gettext-runtime
 gettext-tools-libs
 giflib
 glib2
 gmp
 gnutls
 gobject-introspection
 graphite2
 graphviz
 gts
 harfbuzz
 icu
 jasper
 jbigkit
 lame
 lcms2
 libLASi
 libass
 libbluray
 libde265
 libedit
 libffi
 libheif
 libiconv
 libidn2
 libjpeg-turbo
 libmodplug
 libnetpbm
 libogg
 libopus
 libpixman
 libpng
 librsvg
 libsdl2
 libtasn1
 libtextstyle
 libtheora
 libtool
 libunistring
 libvorbis
 libvpx
 libxml2
 libxslt
 lz4
 m4
 ncurses
 nettle
 openjpeg
 openssl
 openssl3
 ossp-uuid
 p11-kit
 pango
 pcre
 perl5.28
 pkgconfig
 py39-beaker
 py39-mako
 py39-markdown
 py39-markupsafe
 py39-setuptools
 python39
 python3_select
 python_select
 rav1e
 readline
 shared-mime-info
 soxr
 speex
 sqlite3
 tiff
 urw-fonts
 vala
 webp
 x264
 x265
 xorg-libX11
 xorg-libXau
 xorg-libXaw
 xorg-libXdmcp
 xorg-libXext
 xorg-libXmu
 xorg-libXt
 xorg-libice
 xorg-libpthread-stubs
 xorg-libsm
 xorg-libxcb
 xorg-xcb-proto
 xorg-xcb-util
 xorg-xorgproto
 xpm
 xrender
 xz
 zimg
 zlib
 zstd
 zvbi

It essentially pulled whole linux distro ,lmao around 2.05GB just installing scrcpy nothing else.
On Using HomeBrew

brew install scrcpy
==> Downloading https://ghcr.io/v2/homebrew/core/scrcpy/manifests/2.3.1
########################################################################################################################################################### 100.0%
==> Fetching dependencies for scrcpy: brotli, giflib, highway, imath, jpeg-turbo, libpng, xz, lz4, zstd, libtiff, little-cms2, openexr, webp, jpeg-xl, libvmaf, aom, aribb24, dav1d, freetype, fontconfig, frei0r, gmp, libunistring, libidn2, libtasn1, nettle, p11-kit, libevent, libnghttp2, unbound, gnutls, pcre2, glib, xorgproto, libxau, libxdmcp, libxcb, libx11, libxext, libxrender, lzo, pixman, cairo, graphite2, icu4c, harfbuzz, lame, fribidi, libunibreak, libass, libbluray, cjson, libmicrohttpd, mbedtls, librist, libsoxr, libssh, libvidstab, libogg, libvorbis, libvpx, opencore-amr, openjpeg, isl, mpfr, libmpc, gcc, openblas, numpy, pugixml, snappy, hwloc, tbb, openvino, opus, rav1e, libsamplerate, flac, mpg123, libsndfile, rubberband, sdl2, speex, srt, svt-av1, leptonica, libb2, libarchive, pango, tesseract, theora, x264, x265, xvid, libsodium, zeromq, zimg, ffmpeg and libusb

Screenshot 2022-01-08 at 9 27 18 PM

@Genxster1998
Copy link
Contributor

Could scrcpy be build with static libavcodec, libavutil, libavformat, libsdl2 and relevent headers ?

@Coool
Copy link

Coool commented Sep 16, 2022

scrcpy for macOS

@LeeBinder
Copy link

@Coool just in case the news didn't reach you: scrcpy v.1.2.5 is out 🥇

@Coool
Copy link

Coool commented Jan 8, 2023

@LeeBinder I know. Can't keep up with all crap. Build scrcpy v1.25 release. Is it working?

@LeeBinder
Copy link

Great. We're here for fun not on the run .. ;) YES, working fine in Catalina, WELL DONE @Coool ! (can test in Ventura in a few days.)

Now most libs are compiled right into the binary, just leaving libSDL2-2.0.0 and libusb-1.0.0 as external dylibs. From what I know that usually indicates speed increase.

@Coool
Copy link

Coool commented Jan 8, 2023

I will try statically integrate other two, too. But still in progress to figure out.

@LeeBinder
Copy link

@Coool just for the sake of knowing: did you also use MacPorts in any way during the process of building/ compiling your fork?

@Coool
Copy link

Coool commented Apr 11, 2023

@LeeBinder, No. Build all dependencies from original sources at compile time.

@LeeBinder
Copy link

Gotcha. Have you tried compiling v.2.0 yet? Would like to compare differences with my MacPorts build.

@Coool
Copy link

Coool commented Apr 17, 2023

@LeeBinder, scrcpy v2.0 for macOS.

P.S.
Report on which macOS version binary is working!

@LeeBinder
Copy link

Great, thank you @Coool . Less than 9MB compressed, that's impressive. It might be until Sunday nite that I can test in Ventura, Monterey and Big Sur and will let you know then 👍

@Coool
Copy link

Coool commented Apr 19, 2023

@LeeBinder, what your opinion do I need to create new issue suggestion which configure parameters to use for ffmpeg, SDL2 and libusb to optimize binary size? So we can squeeze more 👍.

@rom1v
Copy link
Collaborator

rom1v commented Apr 19, 2023

which configure parameters to use for ffmpeg

You can use the same as the ones used for the Windows release: https://github.com/rom1v/scrcpy-deps/

@Coool
Copy link

Coool commented Apr 20, 2023

@rom1v, are those parameters minimal required to scrcpy functional or we can disable some more not needed libraries function to squeeze as much as we can?

P.S.
Anyway great work. I will try my best to translate documentation to Latvian. Already started with 1.2x, but you have made big progress on 2.0 documentation, so I need to catch up with your great categorized doc, help, wiki.

@rom1v
Copy link
Collaborator

rom1v commented Apr 20, 2023

are those parameters minimal required to scrcpy functional

It is the very minimal FFmpeg configuration with only the features used by scrcpy. The total size of the resulting dlls for Windows is 4.7Mb.

@Coool
Copy link

Coool commented Apr 20, 2023

Why do you need on Windows?

  • CFLAGS=-static-libgcc
  • LDFLAGS=-static-libgcc

@rom1v
Copy link
Collaborator

rom1v commented Apr 20, 2023

Without it, it fails at runtime with missing dll libgcc_s_dw2-1.dll.

https://github.com/rom1v/scrcpy-deps/blob/85d93b375a594574241a05a061d4fba9f522fa57/build_ffmpeg_windows.sh#L13

@Coool
Copy link

Coool commented Apr 20, 2023

@rom1v, check out scrcpy FFmpeg build script for macOS.

P.S.
Strange can't compile scrcpy with your FFmpeg build parameters. All works great only with --disable-shared and --enable-static.

undef: _SecTaskCreateFromSelf
undef: _SecTaskCopyValueForEntitlement
Undefined symbols for architecture x86_64:
"_SecTaskCreateFromSelf", referenced from:
_darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
"_SecTaskCopyValueForEntitlement", referenced from:
_darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)

@LeeBinder
Copy link

LeeBinder commented Apr 23, 2023

@Coool your build (even though compiled in the old macOS High Sierra) runs fine all the way up to the latest Ventura 13.3.1 (also tested in Monterey, Big Sur and Catalina). Apparently your FFmpeg build parameters are fine for macOS.

One suggestion regarding the path to scrcpy-server: can you make it relative rather than static to /Android/scrcpy/scrcpy-server? You can query the current path of the scrcpy binary with a command like cd "$(dirname "$0")" or simply pwd - depending on usage inside your code by assigning a variable like DIR=$( cd $(dirname $0) ; pwd) . Then both binaries, scrcpy and scrcpy-server, could be on the same level ("next to each other").

Also, in a second step, if you can assign a relative path in a way that the scrcpy binary looks for scrcpy-server in ../Resources, it might be possible to package both into an app package scrcpy.app 👍

In case you're curious about that, I've attached an app template zip for that purpose :)

scrcpy 2.0 (Coool) app template.zip

@hellokuan
Copy link

@Coool we need you help , come on

@LeeBinder
Copy link

@hellokuan how do people usually react when someone is being pushy on them? Right, they most likely retract..

Also it's highly unlikely that it's possible to compile for Apple Silicon in the old macOS High Sierra.

Anyway, look here.

@Coool
Copy link

Coool commented May 22, 2023

@hellokuan, based on Stack Overflow article, you need at least Xcode version 12.2. Is it true, I don't know. Until you don't test yourself, don't trust anything what published on web. I'm using Xcode Version 10.1 (10B61) which is latest supported on macOS 10.13.6+ (High Sierra). I will check if it is feasible.

@rom1v rom1v closed this as completed in a7efb18 Nov 24, 2024
@LeeBinder
Copy link

LeeBinder commented Nov 24, 2024

Static genuine/ original build by Romain now also for new Macs with Apple Silicon AArch64 (M*) chip, with builds for Intel Macs still in the works here. Latest v.3.0 as of today Su. Nov. 23, 2024 at https://github.com/Genymobile/scrcpy/releases/tag/v3.0

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

No branches or pull requests

8 participants