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

Standalone Binary for MacOS just like Windows #3235

Closed
Genxster1998 opened this issue May 2, 2022 · 29 comments
Closed

Standalone Binary for MacOS just like Windows #3235

Genxster1998 opened this issue May 2, 2022 · 29 comments

Comments

@Genxster1998
Copy link

Its very deterrent that MacOS users have to install a pathetic package manager which itself cost 3-4GB storage and take immense time to update repo like Homebrew , Macports to install scrcpy .
Is it not going to get solved #1733
Please Close it if its not possible at all .
Others are cashing it out like paid software Wormhole for mac performing same thing essentially using scrcpy source at core .

@LeeBinder
Copy link

LeeBinder commented May 12, 2022

@Genxster1998 in contrast to scrcpy:

  1. for Android, Wormhole also needs an app installed on the phone as per their FAQ (haven't used the software yet)
  2. in macOS, it asks to allow access via System Prefs > Security > Privacy > Accessibility

How do you know that Wormhole for Mac is using scrcpy source at core if there is a core difference to begin with? Can you please share links regarding your claim to follow and read?

(at least their Mac app "only" weighs 124 MB, and their current Android app from October 14, 2021 only 6.8 MB)

@Genxster1998
Copy link
Author

@LeeBinder I meant with technology idea ...
You think scrcpy don't need a server or only need it to be temporarily injected in art /dalvik runtime via a jar not apk ,come on !
I have seen same dependencies like avcodec, avutil avformat libs in its app supporting files .
It uses Qt but I won't say that this is a poor wrapper blatantly copy things underhood.
For windows scrcpy provides fairly standalone binary instead of pulling 2GB+ other unix dependencies packages .

@rom1v
Copy link
Collaborator

rom1v commented May 12, 2022

How do you know that Wormhole for Mac is using scrcpy source at core if there is a core difference to begin with?

Out of curiosity, I just checked: I installed the app in a VM, then decompiled Wormhole.apk (with jadx).
There are a lot of additional dependencies (both for the client and the server).
In the server, only one directory is obfuscated, but there is no doubt that it's the code of scrcpy (an old version).

For example (wormhole on the left, scrcpy on the right):
controlmessagereader
workarounds

All the other files are also obviously the same as scrcpy source files. And the directory structure is the same.

They just replaced "com.genymobile.scrcpy" with "com.viper.wormhole".

@LeeBinder
Copy link

@ Romain I am sorry to see what you just found out. Did they infringe upon the Apache license you have filed scrcpy under as per that section in your ReadMe? I don't see any official mention of scrcpy anywhere throughout their website.

Their Google Pay Store's page discloses their full address (in UK).

@Genxster1998 good job, you have sensitive detective whiskers!

I'm not a dev so even if I looked at the source code, I wouldn't be able to tell the exact digital magic Romain is using for scrcpy. Sure it's doing some live runtime injection into Android components via adb, otherwise it wouldn't perform, but like Romain states in the ReadMe:

non-intrusiveness: nothing is left installed on the Android device

@rom1v would it be of any help if you had a chance to run macOS - would that enable you to compile all the components for a stand-alone package for Mac only containing scrcpy itself + the necessary dependencies (binaries, dylds, headers etc.) analog to the nicely small Windows zip package?

@LeeBinder
Copy link

LeeBinder commented May 13, 2022

@Genxster1998 thanks to neverpanic's detailed yet brief instructions, we can now build the stand-alone ourselves - it's really super-easy, see here and ff 👍

I have scrcpy stand-alone running perfectly in macOS Catalina :)

@shuosiw
Copy link

shuosiw commented Jun 5, 2022

sound that it's already to support Standalone Binary for MacOS?
Good :) I also don't like installing such more dependence haha..

@Coool
Copy link

Coool commented Sep 16, 2022

scrcpy for macOS

@shuosiw
Copy link

shuosiw commented Apr 12, 2023

scrcpy for macOS

@Coool please update v2.0 :) thx

@Coool
Copy link

Coool commented Apr 17, 2023

@shuosiw, scrcpy v2.0 for macOS.

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

@hellokuan
Copy link

@shuosiw, scrcpy v2.0 for macOS.

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

@Coool zsh: bad CPU type in executable: ./scrcpy ,pls support Apple silicon m1&m2,pls update,thx

@hellokuan
Copy link

@Coool can you tell me , how to build a standalone binary for macOS(Apple silicon m1&m2)?

@Genxster1998 Genxster1998 mentioned this issue Aug 9, 2023
2 tasks
@t880216t
Copy link

@shuosiw, scrcpy v2.0 for macOS.

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

Please update to v2.2 or refer to the provided tutorial for instructions. Thank you very much.

@aeroxy
Copy link

aeroxy commented May 13, 2024

@shuosiw, scrcpy v2.0 for macOS.
P.S. Report on which macOS version binary is working!

Please update to v2.2 or refer to the provided tutorial for instructions. Thank you very much.

Please update to v2.4 or refer to the provided tutorial for instructions. Thank you very much.

@muvaf
Copy link
Contributor

muvaf commented Nov 17, 2024

For anyone looking to build the standalone binary themselves, here is a quick build script that I confirmed on an arm64 macOS.

@LeeBinder
Copy link

Hi @muvaf Thank you for the condensed simplifiedscript. Even when I run it on my Intel Mac right form the "root" of my user account's home directory ~, I get:

ERROR: Neither source directory 'build-macos-static' nor build directory None contain a build file meson.build.

I do have meson installed:

$which meson 
/usr/local/bin/meson
$meson -v
1.6.0

meson also installed the latest nasm and ninja as deps, so that can't be it, either.

Changing #!/usr/bin/env bash to #!/usr/bin/env zsh doesn't change that.

~/build-macos-static is empty. A ~/build directory has not been created, but shouldn't that be the same = build-macos-static, too?

Why does it complain with build directory None. Any idea?

@LeeBinder
Copy link

LeeBinder commented Nov 17, 2024

Hi @muvaf Thank you for the condensed simplifiedscript. Even when I run it on my Intel Mac right form the "root" of my user account's home directory ~, I get:

ERROR: Neither source directory 'build-macos-static' nor build directory None contain a build file meson.build.

I do have the latest meson release installed:

$which meson 
/usr/local/bin/meson
$meson -v
1.6.0

meson also installed the latest nasm and ninja as deps. cmake is installed, too (not sure it that's even needed)

$which cmake
/usr/local/bin/cmake
$cmake /V
cmake version 3.31.0

so none of that can't be it, either.

Changing #!/usr/bin/env bash to #!/usr/bin/env zsh doesn't change that (on the side: wondering about the older bash. Did you run into probs with the default zsh?).

~/build-macos-static is empty. A ~/build directory has not been created, but shouldn't that be the same = build-macos-static, too? Why does it complain with build directory None - any idea?

@muvaf
Copy link
Contributor

muvaf commented Nov 18, 2024

@LeeBinder You need to clone this repo, copy the script into it and run it. The meson.build it's looking for is at the top level of this repo.

@rom1v
Copy link
Collaborator

rom1v commented Nov 18, 2024

Refs #5306 (we need a GitHub Actions script for macOS).

@LeeBinder
Copy link

LeeBinder commented Nov 19, 2024

@muvaf

  1. downloaded scrcpy-master.zip and unpacked to ~/scrcpy-master
  2. downloaded your build script and copied it into ~/scrcpy-master
  3. copied meson.build to ~
  4. chmod +x ~/scrcpy-master/build.sh
  5. executing build.sh

Error:

The Meson build system
Version: 1.6.0
Source dir: /Users/lee
Build dir: /Users/lee/build-macos-static
Build type: native build

meson.build:1:0: ERROR: Unknown options: "compile_server, portable, prebuilt_server"

A full log can be found at /Users/lee/build-macos-static/meson-logs/meson-log.txt

meson-log.txt - click to expand
Main binary: /usr/local/opt/python@3.13/bin/python3.13
Build Options: -Db_staticpic=true -Db_lto=true -Dportable=true -Dcompile_server=false -Dprebuilt_server=prebuilt/scrcpy-server-v2.7 -Dc_args=-I/Users/lee/deps-static/libusb-install/include -Dbuildtype=release -Dstrip=True
Python system: Darwin
The Meson build system
Version: 1.6.0
Source dir: /Users/lee
Build dir: /Users/lee/build-macos-static
Build type: native build

meson.build:1:0: ERROR: Unknown options: "compile_server, portable, prebuilt_server"  

Can you share the files(s) that need changes and the correct working lines, please?

@muvaf
Copy link
Contributor

muvaf commented Nov 20, 2024

@LeeBinder You don't need to copy meson.build anywhere. After the downloads, run the following commands in your terminal:

cd ~/scrcpy-master
chmod +x build.sh
./build.sh

@LeeBinder
Copy link

ah OK - YES, now it ran all the way through, and scrcpy is working just fine 💯. Thank you @muvaf - well done 👍

Do you have any idea that this means? Do you get this warning, too?

Found ninja-1.12.1 at /usr/local/bin/ninja
ninja: Entering directory `build-macos-static'
[71/71] Linking target app/scrcpy
ld: warning: could not create compact unwind for _kbd_window_init: stack subq instruction is too different from dwarf stack size
Build complete! Standalone binary is in dist/scrcpy-macos-v2.7

@rom1v
Copy link
Collaborator

rom1v commented Nov 22, 2024

Please see #5515 and help for the macOS static build.

@rom1v
Copy link
Collaborator

rom1v commented Nov 23, 2024

Please test the latest macOS binary here: #5515

@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

@rom1v
Copy link
Collaborator

rom1v commented Nov 24, 2024

@LeeBinder Latest is the official release now 😉

@LeeBinder
Copy link

Ah OK - congrats, Romain 👍 However, the zip should correctly be labeled scrcpy-macos-aarch64-v3.0.tar.gz because it's not for both macOS archs.

@rom1v
Copy link
Collaborator

rom1v commented Nov 24, 2024

Yes, I know, same for Linux. I'll change when there will be more than 1 target released 😉

@rom1v
Copy link
Collaborator

rom1v commented Nov 24, 2024

Here I mentioned arm64 (which is the same as aarch64 I think): https://github.com/Genymobile/scrcpy/blob/master/doc/macos.md#from-the-official-release

@LeeBinder
Copy link

LeeBinder commented Nov 24, 2024

OK, I see. arm64 is the broader overarching term for these general kinds of chips. AArch64 is the official term used by Apple for the exact architecture they use in their M* chips and also referenced in Wikipedia etc.

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

9 participants