From f1bb0f4dcec075d61218cdec5b95779a2a66b24f Mon Sep 17 00:00:00 2001 From: GAURAV KARMAKAR Date: Thu, 29 Jan 2026 00:12:09 +0530 Subject: [PATCH] macOS: Fix hardsub pipeline failing due to arm64/x86_64 build mismatch --- mac/build.command | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mac/build.command b/mac/build.command index ee70dc6a..f1ec6721 100755 --- a/mac/build.command +++ b/mac/build.command @@ -42,7 +42,16 @@ while [[ $# -gt 0 ]]; do esac done -BLD_FLAGS="-std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek" +# Determine architecture based on cargo (to ensure consistency with Rust part) +CARGO_ARCH=$(file $(which cargo) | grep -o 'x86_64\|arm64') +if [[ "$CARGO_ARCH" == "x86_64" ]]; then + echo "Detected Intel (x86_64) Cargo. Forcing x86_64 build to match Rust and libraries..." + BLD_ARCH="-arch x86_64" +else + BLD_ARCH="-arch arm64" +fi + +BLD_FLAGS="$BLD_ARCH -std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek" # Add flags for bundled libraries (not needed when using system libs) if [[ "$USE_SYSTEM_LIBS" != "true" ]]; then