mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-07-25 19:32:03 +08:00
Drop support for Intel macOS (#37215)
* Drop support for Intel macOS * arch.sh * scons * platform.sh * lil more * mv tici
This commit is contained in:
+3
-14
@@ -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",
|
||||
|
||||
Executable
+51
@@ -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
|
||||
Vendored
+5
-6
@@ -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
|
||||
|
||||
Vendored
+2
-13
@@ -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
|
||||
## ```
|
||||
|
||||
Vendored
+2
-6
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+3
-8
@@ -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
|
||||
|
||||
+1
-27
@@ -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() {
|
||||
|
||||
@@ -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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user