openpilot0/tools/mac_setup.sh

116 lines
3.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
mac: fix setup and re-enable CI (#23365) * rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <andrest@trabus.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Bruce Wayne <batman@openpilot-mac-mini.local>
2022-01-08 07:15:18 +08:00
set -e
if [ -z "$SKIP_PROMPT" ]; then
echo "--------------- macOS support ---------------"
echo "Running openpilot natively on macOS is not officially supported."
echo "It might build, some parts of it might work, but it's not fully tested, so there might be some issues."
echo
echo "Check out devcontainers for a seamless experience (see tools/README.md)."
echo "-------------------------------------------------"
echo -n "Are you sure you want to continue? [y/N] "
read -r response
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
ROOT="$(cd $DIR/../ && pwd)"
ARCH=$(uname -m)
if [[ $SHELL == "/bin/zsh" ]]; then
RC_FILE="$HOME/.zshrc"
elif [[ $SHELL == "/bin/bash" ]]; then
RC_FILE="$HOME/.bash_profile"
fi
# Install brew if required
if [[ $(command -v brew) == "" ]]; then
2020-10-29 05:12:56 +08:00
echo "Installing Hombrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
mac: fix setup and re-enable CI (#23365) * rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <andrest@trabus.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Bruce Wayne <batman@openpilot-mac-mini.local>
2022-01-08 07:15:18 +08:00
echo "[ ] installed brew t=$SECONDS"
# make brew available now
if [[ $ARCH == "x86_64" ]]; then
echo 'eval "$(/usr/local/homebrew/bin/brew shellenv)"' >> $RC_FILE
eval "$(/usr/local/homebrew/bin/brew shellenv)"
else
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $RC_FILE
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
fi
brew bundle --file=- <<-EOS
2022-03-06 07:29:06 +08:00
brew "catch2"
brew "cmake"
mac: fix setup and re-enable CI (#23365) * rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <andrest@trabus.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Bruce Wayne <batman@openpilot-mac-mini.local>
2022-01-08 07:15:18 +08:00
brew "cppcheck"
2022-01-01 02:08:34 +08:00
brew "git-lfs"
brew "zlib"
brew "bzip2"
brew "capnp"
brew "coreutils"
brew "eigen"
brew "ffmpeg"
brew "glfw"
brew "libarchive"
brew "libusb"
brew "libtool"
brew "llvm"
brew "openssl@3.0"
brew "pyenv"
brew "pyenv-virtualenv"
2021-03-10 11:37:17 +08:00
brew "qt@5"
brew "zeromq"
brew "gcc@13"
cask "gcc-arm-embedded"
brew "portaudio"
EOS
2021-01-18 23:17:23 +08:00
mac: fix setup and re-enable CI (#23365) * rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <andrest@trabus.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Bruce Wayne <batman@openpilot-mac-mini.local>
2022-01-08 07:15:18 +08:00
echo "[ ] finished brew install t=$SECONDS"
BREW_PREFIX=$(brew --prefix)
# archive backend tools for pip dependencies
export LDFLAGS="$LDFLAGS -L${BREW_PREFIX}/opt/zlib/lib"
export LDFLAGS="$LDFLAGS -L${BREW_PREFIX}/opt/bzip2/lib"
export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/zlib/include"
export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/bzip2/include"
# pycurl curl/openssl backend dependencies
export LDFLAGS="$LDFLAGS -L${BREW_PREFIX}/opt/openssl@3/lib"
export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/openssl@3/include"
macOS: fix build issues & re-enable CI (#28258) * Uncomment build_mac job * Add PYCURL_CURL_CONFIG * Acados universal binary * Remove x86 macos references from sconscript * Add missing include in cabana * Update cereal * Update workflow * Remove unnecessary libpaths for darwin * Add missing path to cached dirs * Fix path in cache preparation step * Add poetry caches to CI cache * Compile acados with lower deployment target for CI * Update cereal * Pass -rpath in linker flags as scons doed not support RPATH on macos * Use scons api instead of os * @rpath in install name of acados dylibs * SConstruct cleanup * fix liblocationd tests by adding lib suffix based on platform * Update cereal * Update opendbc * Update opendbc * Add acados gitignore to release files * Update cereal * Update cereal * Add scons_cache to build cache * Add Caskroom to cache * Fix typo * Link all packages at once, instead of one by one * Run cleanup stage using poetry * Remove casks from cache * Move scons cache to separate cache step * Save scons cache only on master * Remove restore-keys from save-scons-cache step * Uncomment if conditions for scons save * Add gcc-arm-embedded cask cache to cache * Custom handling of gcc-arm-embedded toolchain cache * Rename dep cache key * Exclude .fseventsd from cache * Fix glob pattern * Remove .feventsd before caching * Run mac_setup only if dependency cache-hit != true * Update cereal to master * Add overwrite flag to brew link * Remove manual casadi build from mac_setup * Remove restore-keys from dependency cache * Remove linux requirement for casadi * Restore restore-keys to dependency cache
2023-06-22 04:14:20 +08:00
export PYCURL_CURL_CONFIG=/usr/bin/curl-config
export PYCURL_SSL_LIBRARY=openssl
# install python dependencies
$DIR/install_python_dependencies.sh
mac: fix setup and re-enable CI (#23365) * rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <andrest@trabus.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Bruce Wayne <batman@openpilot-mac-mini.local>
2022-01-08 07:15:18 +08:00
echo "[ ] installed python dependencies t=$SECONDS"
# brew does not link qt5 by default
# check if qt5 can be linked, if not, prompt the user to link it
QT_BIN_LOCATION="$(command -v lupdate || :)"
if [ -n "$QT_BIN_LOCATION" ]; then
# if qt6 is linked, prompt the user to unlink it and link the right version
QT_BIN_VERSION="$(lupdate -version | awk '{print $NF}')"
if [[ ! "$QT_BIN_VERSION" =~ 5\.[0-9]+\.[0-9]+ ]]; then
echo
echo "lupdate/lrelease available at PATH is $QT_BIN_VERSION"
if [[ "$QT_BIN_LOCATION" == "$(brew --prefix)/"* ]]; then
echo "Run the following command to link qt5:"
echo "brew unlink qt@6 && brew link qt@5"
else
echo "Remove conflicting qt entries from PATH and run the following command to link qt5:"
echo "brew link qt@5"
fi
fi
else
brew link qt@5
fi
echo
mac: fix setup and re-enable CI (#23365) * rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <andrest@trabus.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Bruce Wayne <batman@openpilot-mac-mini.local>
2022-01-08 07:15:18 +08:00
echo "---- OPENPILOT SETUP DONE ----"
echo "Open a new shell or configure your active shell env by running:"
echo "source $RC_FILE"