Bug fix for duplicate rpath errors on macOS when creating build caches (#34375)
This commit is contained in:
parent
f83972ddc4
commit
5b02b7003a
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
import collections
|
import collections
|
||||||
|
import itertools
|
||||||
import multiprocessing.pool
|
import multiprocessing.pool
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -296,17 +297,24 @@ def modify_macho_object(cur_path, rpaths, deps, idpath, paths_to_paths):
|
|||||||
if idpath:
|
if idpath:
|
||||||
new_idpath = paths_to_paths.get(idpath, None)
|
new_idpath = paths_to_paths.get(idpath, None)
|
||||||
if new_idpath and not idpath == new_idpath:
|
if new_idpath and not idpath == new_idpath:
|
||||||
args += ["-id", new_idpath]
|
args += [("-id", new_idpath)]
|
||||||
|
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
new_dep = paths_to_paths.get(dep)
|
new_dep = paths_to_paths.get(dep)
|
||||||
if new_dep and dep != new_dep:
|
if new_dep and dep != new_dep:
|
||||||
args += ["-change", dep, new_dep]
|
args += [("-change", dep, new_dep)]
|
||||||
|
|
||||||
|
new_rpaths = []
|
||||||
for orig_rpath in rpaths:
|
for orig_rpath in rpaths:
|
||||||
new_rpath = paths_to_paths.get(orig_rpath)
|
new_rpath = paths_to_paths.get(orig_rpath)
|
||||||
if new_rpath and not orig_rpath == new_rpath:
|
if new_rpath and not orig_rpath == new_rpath:
|
||||||
args += ["-rpath", orig_rpath, new_rpath]
|
args_to_add = ("-rpath", orig_rpath, new_rpath)
|
||||||
|
if args_to_add not in args and new_rpath not in new_rpaths:
|
||||||
|
args += [args_to_add]
|
||||||
|
new_rpaths.append(new_rpath)
|
||||||
|
|
||||||
|
# Deduplicate and flatten
|
||||||
|
args = list(itertools.chain.from_iterable(llnl.util.lang.dedupe(args)))
|
||||||
if args:
|
if args:
|
||||||
args.append(str(cur_path))
|
args.append(str(cur_path))
|
||||||
install_name_tool = executable.Executable("install_name_tool")
|
install_name_tool = executable.Executable("install_name_tool")
|
||||||
|
Loading…
Reference in New Issue
Block a user