From 822a7367c1912d8b19263bfbda15bf29b188d67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Fri, 12 May 2023 11:06:08 -0700 Subject: [PATCH] macOS: use homebrew gcc using version suffix. update setup instructions (#1409) * Add version suffix to gcc on Darwin * Update macos setup intructions * Delete unused SConscript at tests/ * Move gcc stuff to tests/libpanda/SConscript --- README.md | 4 ++-- tests/libpanda/SConscript | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 90bc83647..1b325d801 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ sudo apt-get install dfu-util gcc-arm-none-eabi python3-pip libffi-dev git ``` ```bash # macOS -brew tap ArmMbed/homebrew-formulae -brew install python dfu-util arm-none-eabi-gcc gcc@12 +brew install --cask gcc-arm-embedded +brew install python3 dfu-util gcc@12 ``` Clone panda repository: diff --git a/tests/libpanda/SConscript b/tests/libpanda/SConscript index 000ca63ca..f9f052e45 100644 --- a/tests/libpanda/SConscript +++ b/tests/libpanda/SConscript @@ -1,5 +1,14 @@ +import platform + +CC = 'gcc' +system = platform.system() +if system == 'Darwin': + # gcc installed by homebrew has version suffix (e.g. gcc-12) in order to be + # distinguishable from system one - which acts as a symlink to clang + CC += '-12' + env = Environment( - CC='gcc', + CC=CC, CFLAGS=[ '-nostdlib', '-fno-builtin', @@ -8,7 +17,8 @@ env = Environment( ], CPPPATH=[".", "../../board/"], ) -env.PrependENVPath('PATH', '/opt/homebrew/bin') +if system == "Darwin": + env.PrependENVPath('PATH', '/opt/homebrew/bin') if GetOption('ubsan'): flags = [