From eea07462fad217a2e98decf7392818dbb0f22478 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 14 Feb 2026 21:00:29 -0800 Subject: [PATCH] Drop support for Intel macOS (#37215) * Drop support for Intel macOS * arch.sh * scons * platform.sh * lil more * mv tici --- SConstruct | 17 ++-------- scripts/platform.sh | 51 ++++++++++++++++++++++++++++ third_party/acados/build.sh | 11 +++--- third_party/libyuv/build.sh | 15 ++------ third_party/raylib/build.sh | 8 ++--- tools/install_python_dependencies.sh | 2 +- tools/mac_setup.sh | 11 ++---- tools/op.sh | 28 +-------------- tools/plotjuggler/juggle.py | 2 +- 9 files changed, 69 insertions(+), 76 deletions(-) create mode 100755 scripts/platform.sh diff --git a/SConstruct b/SConstruct index 4f04be624..05885c0b5 100644 --- a/SConstruct +++ b/SConstruct @@ -2,7 +2,6 @@ import os import subprocess import sys import sysconfig -import platform import shlex import numpy as np @@ -24,19 +23,8 @@ AddOption('--minimal', default=os.path.exists(File('#.gitattributes').abspath), # minimal by default on release branch (where there's no LFS) help='the minimum build to run openpilot. no tests, tools, etc.') -# Detect platform -arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() -if platform.system() == "Darwin": - arch = "Darwin" - brew_prefix = subprocess.check_output(['brew', '--prefix'], encoding='utf8').strip() -elif arch == "aarch64" and os.path.isfile('/TICI'): - arch = "larch64" -assert arch in [ - "larch64", # linux tici arm64 - "aarch64", # linux pc arm64 - "x86_64", # linux pc x64 - "Darwin", # macOS arm64 (x86 not supported) -] +# Detect platform (see scripts/platform.sh) +arch = subprocess.check_output(["bash", "-c", "source scripts/platform.sh >&2 && echo $OPENPILOT_ARCH"], encoding='utf8', stderr=subprocess.PIPE).rstrip() env = Environment( ENV={ @@ -103,6 +91,7 @@ if arch == "larch64": env.Append(CCFLAGS=arch_flags) env.Append(CXXFLAGS=arch_flags) elif arch == "Darwin": + brew_prefix = subprocess.check_output(['brew', '--prefix'], encoding='utf8').strip() env.Append(LIBPATH=[ f"{brew_prefix}/lib", f"{brew_prefix}/opt/openssl@3.0/lib", diff --git a/scripts/platform.sh b/scripts/platform.sh new file mode 100755 index 000000000..1cbd8aa60 --- /dev/null +++ b/scripts/platform.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# Centralized platform and architecture detection for openpilot. +# Source this script to get OPENPILOT_ARCH set to one of: +# larch64 - linux tici arm64 +# aarch64 - linux pc arm64 +# x86_64 - linux pc x64 +# Darwin - macOS arm64 +# + +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' + +OPENPILOT_ARCH=$(uname -m) + +# ── check OS and normalize arch ────────────────────────────── +if [ -f /TICI ]; then + # TICI runs AGNOS — no OS validation needed + OPENPILOT_ARCH="larch64" + +elif [[ "$OSTYPE" == "darwin"* ]]; then + if [[ "$OPENPILOT_ARCH" == "x86_64" ]]; then + echo -e " ↳ [${RED}✗${NC}] Intel-based Macs are not supported!" + echo " openpilot requires an Apple Silicon Mac (M1 or newer)." + exit 1 + fi + echo -e " ↳ [${GREEN}✔${NC}] macOS detected." + OPENPILOT_ARCH="Darwin" + +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + if [ -f "/etc/os-release" ]; then + source /etc/os-release + case "$VERSION_CODENAME" in + "jammy" | "kinetic" | "noble" | "focal") + echo -e " ↳ [${GREEN}✔${NC}] Ubuntu $VERSION_CODENAME detected." + ;; + *) + echo -e " ↳ [${RED}✗${NC}] Incompatible Ubuntu version $VERSION_CODENAME detected!" + exit 1 + ;; + esac + else + echo -e " ↳ [${RED}✗${NC}] No /etc/os-release on your system. Make sure you're running on Ubuntu, or similar!" + exit 1 + fi + +else + echo -e " ↳ [${RED}✗${NC}] OS type $OSTYPE not supported!" + exit 1 +fi diff --git a/third_party/acados/build.sh b/third_party/acados/build.sh index 2c4d839ae..cca174350 100755 --- a/third_party/acados/build.sh +++ b/third_party/acados/build.sh @@ -6,18 +6,18 @@ export ZERO_AR_DATE=1 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" -ARCHNAME="x86_64" +source "$DIR/../../scripts/platform.sh" +ARCHNAME="$OPENPILOT_ARCH" + BLAS_TARGET="X64_AUTOMATIC" if [ -f /TICI ]; then - ARCHNAME="larch64" BLAS_TARGET="ARMV8A_ARM_CORTEX_A57" fi ACADOS_FLAGS="-DACADOS_WITH_QPOASES=ON -UBLASFEO_TARGET -DBLASFEO_TARGET=$BLAS_TARGET" if [[ "$OSTYPE" == "darwin"* ]]; then - ACADOS_FLAGS="$ACADOS_FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 -DCMAKE_MACOSX_RPATH=1" - ARCHNAME="Darwin" + ACADOS_FLAGS="$ACADOS_FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_MACOSX_RPATH=1" fi if [ ! -d acados_repo/ ]; then @@ -57,8 +57,7 @@ fi cd $DIR/acados_repo/interfaces/acados_template/tera_renderer/ if [[ "$OSTYPE" == "darwin"* ]]; then cargo build --verbose --release --target aarch64-apple-darwin - cargo build --verbose --release --target x86_64-apple-darwin - lipo -create -output target/release/t_renderer target/x86_64-apple-darwin/release/t_renderer target/aarch64-apple-darwin/release/t_renderer + cp target/aarch64-apple-darwin/release/t_renderer target/release/t_renderer else cargo build --verbose --release fi diff --git a/third_party/libyuv/build.sh b/third_party/libyuv/build.sh index 35a7d947a..0e4e10133 100755 --- a/third_party/libyuv/build.sh +++ b/third_party/libyuv/build.sh @@ -6,14 +6,8 @@ export ZERO_AR_DATE=1 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" -ARCHNAME=$(uname -m) -if [ -f /TICI ]; then - ARCHNAME="larch64" -fi - -if [[ "$OSTYPE" == "darwin"* ]]; then - ARCHNAME="Darwin" -fi +source "$DIR/../../scripts/platform.sh" +ARCHNAME="$OPENPILOT_ARCH" cd $DIR if [ ! -d libyuv ]; then @@ -35,8 +29,3 @@ rm -rf $DIR/include mkdir -p $INSTALL_DIR/lib cp $DIR/libyuv/libyuv.a $INSTALL_DIR/lib cp -r $DIR/libyuv/include $DIR - -## To create universal binary on Darwin: -## ``` -## lipo -create -output Darwin/libyuv.a path-to-x64/libyuv.a path-to-arm64/libyuv.a -## ``` diff --git a/third_party/raylib/build.sh b/third_party/raylib/build.sh index d20f9d33a..b8408cd88 100755 --- a/third_party/raylib/build.sh +++ b/third_party/raylib/build.sh @@ -20,9 +20,9 @@ cd $DIR RAYLIB_PLATFORM="PLATFORM_DESKTOP" -ARCHNAME=$(uname -m) +source "$DIR/../../scripts/platform.sh" +ARCHNAME="$OPENPILOT_ARCH" if [ -f /TICI ]; then - ARCHNAME="larch64" RAYLIB_PLATFORM="PLATFORM_COMMA" elif [[ "$OSTYPE" == "linux"* ]]; then # required dependencies on Linux PC @@ -33,10 +33,6 @@ elif [[ "$OSTYPE" == "linux"* ]]; then libxrandr-dev fi -if [[ "$OSTYPE" == "darwin"* ]]; then - ARCHNAME="Darwin" -fi - INSTALL_DIR="$DIR/$ARCHNAME" rm -rf $INSTALL_DIR mkdir -p $INSTALL_DIR diff --git a/tools/install_python_dependencies.sh b/tools/install_python_dependencies.sh index 4454845fc..bf7accbbd 100755 --- a/tools/install_python_dependencies.sh +++ b/tools/install_python_dependencies.sh @@ -23,7 +23,7 @@ echo "installing python packages..." uv sync --frozen --all-extras source .venv/bin/activate -if [[ "$(uname)" == 'Darwin' ]]; then +if [[ "$OSTYPE" == "darwin"* ]]; then touch "$ROOT"/.env echo "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> "$ROOT"/.env fi diff --git a/tools/mac_setup.sh b/tools/mac_setup.sh index 26ef4dd9a..7e126d4f5 100755 --- a/tools/mac_setup.sh +++ b/tools/mac_setup.sh @@ -3,7 +3,7 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" ROOT="$(cd $DIR/../ && pwd)" -ARCH=$(uname -m) +source $ROOT/scripts/platform.sh # homebrew update is slow export HOMEBREW_NO_AUTO_UPDATE=1 @@ -21,13 +21,8 @@ if [[ $(command -v brew) == "" ]]; then echo "[ ] installed brew t=$SECONDS" # make brew available now - if [[ $ARCH == "x86_64" ]]; then - echo 'eval "$(/usr/local/bin/brew shellenv)"' >> $RC_FILE - eval "$(/usr/local/bin/brew shellenv)" - else - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $RC_FILE - eval "$(/opt/homebrew/bin/brew shellenv)" - fi + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $RC_FILE + eval "$(/opt/homebrew/bin/brew shellenv)" else brew up fi diff --git a/tools/op.sh b/tools/op.sh index 8c41926e0..afee4cfb7 100755 --- a/tools/op.sh +++ b/tools/op.sh @@ -122,33 +122,7 @@ function op_check_git() { function op_check_os() { echo "Checking for compatible os version..." - if [[ "$OSTYPE" == "linux-gnu"* ]]; then - - if [ -f "/etc/os-release" ]; then - source /etc/os-release - case "$VERSION_CODENAME" in - "jammy" | "kinetic" | "noble" | "focal") - echo -e " ↳ [${GREEN}✔${NC}] Ubuntu $VERSION_CODENAME detected." - ;; - * ) - echo -e " ↳ [${RED}✗${NC}] Incompatible Ubuntu version $VERSION_CODENAME detected!" - loge "ERROR_INCOMPATIBLE_UBUNTU" "$VERSION_CODENAME" - return 1 - ;; - esac - else - echo -e " ↳ [${RED}✗${NC}] No /etc/os-release on your system. Make sure you're running on Ubuntu, or similar!" - loge "ERROR_UNKNOWN_UBUNTU" - return 1 - fi - - elif [[ "$OSTYPE" == "darwin"* ]]; then - echo -e " ↳ [${GREEN}✔${NC}] macOS detected." - else - echo -e " ↳ [${RED}✗${NC}] OS type $OSTYPE not supported!" - loge "ERROR_UNKNOWN_OS" "$OSTYPE" - return 1 - fi + source "$OPENPILOT_ROOT/scripts/platform.sh" } function op_check_python() { diff --git a/tools/plotjuggler/juggle.py b/tools/plotjuggler/juggle.py index 142e64050..c04efd50b 100755 --- a/tools/plotjuggler/juggle.py +++ b/tools/plotjuggler/juggle.py @@ -31,7 +31,7 @@ MAX_STREAMING_BUFFER_SIZE = 1000 def install(): m = f"{platform.system()}-{platform.machine()}" - supported = ("Linux-x86_64", "Linux-aarch64", "Darwin-arm64", "Darwin-x86_64") + supported = ("Linux-x86_64", "Linux-aarch64", "Darwin-arm64") if m not in supported: raise Exception(f"Unsupported platform: '{m}'. Supported platforms: {supported}")