-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
macos: enable static binaries #5517
Conversation
Provide a prebuilt binary for Linux.
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Thank you! 👍
Maybe installing For |
@rom1v When I install those, I see the following in the brew logs:
So, these are probably expected to be present on all macOS systems, hence not needed to be statically linked. Still, I tried adding the following to before the LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/zlib/lib"
CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/zlib/include"
LDFLAGS="$LDFLAGS-L/opt/homebrew/opt/libiconv/lib"
CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/libiconv/include" Still got the same warnings. Adding the following didn't make any difference either: PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/homebrew/opt/zlib/lib/pkgconfig" |
It should probably be added before the |
@rom1v No change. Here is the latest script: #!/bin/bash
set -ex
cd "$(dirname ${BASH_SOURCE[0]})"
. build_common
cd .. # root project dir
MACOS_BUILD_DIR="$WORK_DIR/build-macos"
LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/zlib/lib"
CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/zlib/include"
LDFLAGS="$LDFLAGS-L/opt/homebrew/opt/libiconv/lib"
CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/libiconv/include"
app/deps/adb_macos.sh
app/deps/sdl.sh macos native static
app/deps/ffmpeg.sh macos native static
app/deps/libusb.sh macos native static
DEPS_INSTALL_DIR="$PWD/app/deps/work/install/macos-native-static"
ADB_INSTALL_DIR="$PWD/app/deps/work/install/adb-macos"
rm -rf "$MACOS_BUILD_DIR"
meson setup "$MACOS_BUILD_DIR" \
--pkg-config-path="$DEPS_INSTALL_DIR/lib/pkgconfig" \
-Dc_args="-I$DEPS_INSTALL_DIR/include" \
-Dc_link_args="-L$DEPS_INSTALL_DIR/lib" \
--buildtype=release \
--strip \
-Db_lto=true \
-Dcompile_server=false \
-Dportable=true \
-Dstatic=true
ninja -C "$MACOS_BUILD_DIR"
# Group intermediate outputs into a 'dist' directory
mkdir -p "$MACOS_BUILD_DIR/dist"
cp "$MACOS_BUILD_DIR"/app/scrcpy "$MACOS_BUILD_DIR/dist/scrcpy_bin"
cp app/data/icon.png "$MACOS_BUILD_DIR/dist/"
cp app/data/scrcpy_static_wrapper.sh "$MACOS_BUILD_DIR/dist/scrcpy"
cp -r "$ADB_INSTALL_DIR"/. "$MACOS_BUILD_DIR/dist/" This is the logs: |
This is not |
OK so I added the following right before the export LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/zlib/include"
export LDFLAGS="$LDFLAGS-L/opt/homebrew/opt/libiconv/lib"
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/libiconv/include" In the logs, I see that the ones warning about @rom1v FWIW, I think you may be able to get faster feedback if you manually trigger the workflow in GH actions after making changes. You may not be able to test it but seeing logs should help with these warnings. |
With this line in addition: export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig" the logs about zlib are also gone 👍
Yes, I'm doing that a lot 👍 |
Incorporated into #5515 |
Due to a typo (a space was missing before the second '-L'), the resulting LDFLAGS value was broken: "-L/opt/homebrew/opt/zlib/lib-L/opt/homebrew/opt/libiconv/lib" This proves that the flag was useless. Remove it. Refs Genymobile#5517 comment <Genymobile#5517 (comment)>
Due to a typo (a space was missing before the second '-L'), the resulting LDFLAGS value was broken: "-L/opt/homebrew/opt/zlib/lib-L/opt/homebrew/opt/libiconv/lib" This proves that the flag was useless. Remove it. Refs Genymobile#5517 comment <Genymobile#5517 (comment)>
Due to a typo (a space was missing before the second '-L'), the resulting LDFLAGS value was broken: "-L/opt/homebrew/opt/zlib/lib-L/opt/homebrew/opt/libiconv/lib" This proves that the flag was useless. Remove it. Refs #5517 comment <#5517 (comment)> PR #5644 <#5644>
Here is the build log, ran on macOS arm64 15.1.1 (24B91).
build_log.txt
I saw some warnings about
objc
which might be useful:When I run it against a locally running emulator, I had to copy
scrcpy-server
into the folder the binary exists.