From 212a05b87ed34f921dfd07142305389dbfa9bb7d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 11 Oct 2019 11:01:22 -0400 Subject: Remove duplicated object files in static libraries When a static library link_whole to a bunch of other static libraries, we have to extract all their objects recursively. But that could introduce duplicated objects. ar is dumb enough to allow this without error, but once the resulting static library is linked into an executable or shared library, the linker will complain about duplicated symbols. --- mesonbuild/backend/backends.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mesonbuild/backend/backends.py') diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 947be1c..e548096 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -281,7 +281,8 @@ class Backend: os.path.join('dummyprefixdir', fromdir)) def flatten_object_list(self, target, proj_dir_to_build_root=''): - return self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root) + obj_list = self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root) + return list(dict.fromkeys(obj_list)) def _flatten_object_list(self, target, objects, proj_dir_to_build_root): obj_list = [] -- cgit v1.1