From 1563bac5e7390e767a2cea2fec995d9256f72d85 Mon Sep 17 00:00:00 2001 From: Aditya Vidyadhar Kamath Date: Sun, 29 Oct 2023 23:02:24 -0500 Subject: [PATCH] Fix to 'NoneType' object has no attribute 'get_command_to_archive_shlib' --- mesonbuild/backend/ninjabackend.py | 18 +++++++++--------- mesonbuild/compilers/compilers.py | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 186809e87e74..8cb0bbcf046b 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2382,13 +2382,13 @@ def generate_dynamic_link_rules(self): options = self._rsp_options(compiler) self.add_rule(NinjaRule(rule, command, args, description, **options, extra=pool)) - if self.environment.machines[for_machine].is_aix(): - rule = 'AIX_LINKER{}'.format(self.get_rule_suffix(for_machine)) - description = 'Archiving AIX shared library' - cmdlist = compiler.get_command_to_archive_shlib() - args = [] - options = {} - self.add_rule(NinjaRule(rule, cmdlist, args, description, **options, extra=None)) + if self.environment.machines[for_machine].is_aix(): + rule = 'AIX_LINKER{}'.format(self.get_rule_suffix(for_machine)) + description = 'Archiving AIX shared library' + cmdlist = compiler.get_command_to_archive_shlib() + args = [] + options = {} + self.add_rule(NinjaRule(rule, cmdlist, args, description, **options, extra=None)) args = self.environment.get_build_command() + \ ['--internal', @@ -3695,8 +3695,8 @@ def generate_ending(self) -> None: # Add the first output of each target to the 'all' target so that # they are all built #Add archive file if shared library in AIX for build all. - if self.environment.machines[t.for_machine].is_aix(): - if isinstance(t, build.SharedLibrary) and t.aix_so_archive: + if isinstance(t, build.SharedLibrary) and t.aix_so_archive: + if self.environment.machines[t.for_machine].is_aix(): linker, stdlib_args = self.determine_linker_and_stdlib_args(t) t.get_outputs()[0] = linker.get_archive_name(t.get_outputs()[0]) targetlist.append(os.path.join(self.get_target_dir(t), t.get_outputs()[0])) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index c7af1cac6841..f27bbeed4e9e 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -960,6 +960,8 @@ def get_archive_name(self, filename: str) -> str: return self.linker.get_archive_name(filename) def get_command_to_archive_shlib(self) -> T.List[str]: + if not self.linker: + return [] return self.linker.get_command_to_archive_shlib() def thread_flags(self, env: 'Environment') -> T.List[str]: