From 333ccce242c35e29350ff804db17967ffd10f269 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Tue, 22 Nov 2022 12:07:58 -0800 Subject: [PATCH 1/3] On Linux, install and use GCC 10 if currently not using 9 or 10. --- scripts/gha/install_prereqs_desktop.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/gha/install_prereqs_desktop.py b/scripts/gha/install_prereqs_desktop.py index 88ca21ed61..3190edb206 100644 --- a/scripts/gha/install_prereqs_desktop.py +++ b/scripts/gha/install_prereqs_desktop.py @@ -83,6 +83,24 @@ def main(): # brew install protobuf utils.run_command(['brew', 'install', 'clang-format']) + # On Linux, if gcc-10 isn't installed install it. Then make it the default. + if utils.is_linux_os(): + # Check if we have gcc 9 or gcc 10 as the default, if not, set gcc 10. + gcc_ver = run_command('gcc', '-v', capture_output=True) + if not ("gcc version 9." in gcc_ver.stderr or "gcc version 10." in gcc_ver.stderr): + if (not utils.is_command_installed('gcc-10') or + not utils.is_command_installed('g++-10')): + utils.run_command(['apt', 'install', '-y', 'gcc-10', 'g++-10'], + as_root=True) + utils.run_command(['update-alternatives', '--install', '/usr/bin/gcc', + 'gcc', '/usr/bin/gcc-10', '10'], as_root=True) + utils.run_command(['update-alternatives', '--install', '/usr/bin/g++', + 'g++', '/usr/bin/g++-10', '10'], as_root=True) + utils.run_command(['update-alternatives', '--set', 'gcc', + '/usr/bin/gcc-10'], as_root=True) + utils.run_command(['update-alternatives', '--set', 'g++', + '/usr/bin/g++-10'], as_root=True) + # Install required python dependencies. # On Catalina, python2 in installed as default python. # Example command: From ea393bfefdbfa49f5f0eb7910a9fcbb09b366ddb Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Tue, 22 Nov 2022 12:36:32 -0800 Subject: [PATCH 2/3] Fix typo --- scripts/gha/install_prereqs_desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gha/install_prereqs_desktop.py b/scripts/gha/install_prereqs_desktop.py index 3190edb206..d5e8f89b87 100644 --- a/scripts/gha/install_prereqs_desktop.py +++ b/scripts/gha/install_prereqs_desktop.py @@ -86,7 +86,7 @@ def main(): # On Linux, if gcc-10 isn't installed install it. Then make it the default. if utils.is_linux_os(): # Check if we have gcc 9 or gcc 10 as the default, if not, set gcc 10. - gcc_ver = run_command('gcc', '-v', capture_output=True) + gcc_ver = utils.run_command('gcc', '-v', capture_output=True) if not ("gcc version 9." in gcc_ver.stderr or "gcc version 10." in gcc_ver.stderr): if (not utils.is_command_installed('gcc-10') or not utils.is_command_installed('g++-10')): From 71b8d9c40a93ac5f8a5251aad0c8d4ebba5d8120 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Tue, 22 Nov 2022 13:00:14 -0800 Subject: [PATCH 3/3] Fix typo 2 --- scripts/gha/install_prereqs_desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gha/install_prereqs_desktop.py b/scripts/gha/install_prereqs_desktop.py index d5e8f89b87..28bd9bbde0 100644 --- a/scripts/gha/install_prereqs_desktop.py +++ b/scripts/gha/install_prereqs_desktop.py @@ -86,7 +86,7 @@ def main(): # On Linux, if gcc-10 isn't installed install it. Then make it the default. if utils.is_linux_os(): # Check if we have gcc 9 or gcc 10 as the default, if not, set gcc 10. - gcc_ver = utils.run_command('gcc', '-v', capture_output=True) + gcc_ver = utils.run_command(['gcc', '-v'], capture_output=True) if not ("gcc version 9." in gcc_ver.stderr or "gcc version 10." in gcc_ver.stderr): if (not utils.is_command_installed('gcc-10') or not utils.is_command_installed('g++-10')):