From eac43304ac6c73b400ede80e7792e7906e375fda Mon Sep 17 00:00:00 2001 From: SolitaryThinker Date: Tue, 5 May 2026 14:35:04 -0700 Subject: [PATCH] [fix] dreamverse: pin ffmpeg native build toolchain by uname -m * The conda fv-main env activates BOTH gcc_linux-64 and gcc_linux-aarch64 triplets on every `conda activate` (alphabetical order makes aarch64 win), so on an x86_64 host the inherited `CC=aarch64-conda-linux-gnu-cc` defeated the script's `: "${CC:=...}"` deferred default and tripped x264's compiler probe with "unknown value 'native' for '-march'". * Replace deferred defaults with unconditional assignment per `uname -m`. Matches the team playbook's `export CC=...` semantics verbatim. * Print the toolchain banner up front so future probe failures are diagnosable from the first lines of stdout. Co-authored-by: Junda (David) Su <90978028+Davids048@users.noreply.github.com> Co-authored-by: Matthew Noto <99706358+RandNMR73@users.noreply.github.com> Co-authored-by: XOR-op <17672363+XOR-op@users.noreply.github.com> Co-authored-by: Zhang Peiyuan <42993249+jzhang38@users.noreply.github.com> --- .../scripts/install_native_ffmpeg.sh | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/apps/dreamverse/scripts/install_native_ffmpeg.sh b/apps/dreamverse/scripts/install_native_ffmpeg.sh index 742961ee8..dcf6fc066 100755 --- a/apps/dreamverse/scripts/install_native_ffmpeg.sh +++ b/apps/dreamverse/scripts/install_native_ffmpeg.sh @@ -26,8 +26,15 @@ # X264_REF x264 git ref default: stable # FFMPEG_REF FFmpeg git ref default: n7.1 # MAKE_JOBS parallel make jobs default: min(nproc, 16) -# CC, CXX, AS compiler / assembler default: conda-forge triplet # +# Toolchain selection: CC / CXX / AS are pinned to the conda-forge +# triplet matching `uname -m`. Inherited values are intentionally +# ignored — conda envs that have BOTH `gcc_linux-64` and +# `gcc_linux-aarch64` installed export the cross-compiler triplet on +# every `conda activate` (the `aarch64` activation script sorts later +# and wins), which silently breaks x264's compiler probe on the +# opposite host. If you genuinely need a non-host toolchain, edit the +# case block below. set -euo pipefail # ─── Defaults (override via env) ────────────────────────────────────────── @@ -39,23 +46,23 @@ NPROC="$(nproc)" MAKE_JOBS="${MAKE_JOBS:-$(( NPROC < 16 ? NPROC : 16 ))}" # ─── Per-platform, per-stage flags (verbatim from the playbook) ─────────── -# TODO: edit the CC/CXX defaults below if you are NOT using the conda-forge -# gcc_linux-{64,aarch64} toolchain. e.g.: CC=gcc CXX=g++. -# The probe step below probes whatever CC/CXX resolve to, so this -# block is the single source of truth for compiler choice. +# Toolchain is force-set per `uname -m`, NOT defaulted via `${CC:=...}`. +# Conda envs that activated both gcc_linux-64 and gcc_linux-aarch64 +# export the cross triplet on every `conda activate`, which would +# defeat a deferred default and trip x264's compiler probe. case "$(uname -m)" in x86_64) - : "${CC:=x86_64-conda-linux-gnu-cc}" - : "${CXX:=x86_64-conda-linux-gnu-c++}" - : "${AS:=nasm}" + CC=x86_64-conda-linux-gnu-cc + CXX=x86_64-conda-linux-gnu-c++ + AS=nasm X264_CFLAGS="-O3 -march=native -mtune=native -fPIC -flto" X264_LDFLAGS="-flto -fuse-linker-plugin" FFMPEG_CFLAGS="-O3 -march=native -mtune=native -fPIC -flto" FFMPEG_LDFLAGS="-flto -Wl,-rpath,$INSTALL_PREFIX/lib" ;; aarch64) - : "${CC:=aarch64-conda-linux-gnu-cc}" - : "${CXX:=aarch64-conda-linux-gnu-c++}" + CC=aarch64-conda-linux-gnu-cc + CXX=aarch64-conda-linux-gnu-c++ unset AS # GNU as on ARM X264_CFLAGS="-O3 -mcpu=native -fPIC -flto" X264_LDFLAGS="-flto -fuse-linker-plugin" @@ -69,6 +76,7 @@ case "$(uname -m)" in esac export CC CXX [[ -n "${AS:-}" ]] && export AS +echo "[install_native_ffmpeg] toolchain: CC=$CC CXX=$CXX AS=${AS:-} (uname -m=$(uname -m))" # ─── Step 0: probe required tools ───────────────────────────────────────── required=("$CC" "$CXX" make pkg-config git)