Binary Distribution: Relocate RPATH on Cray (#18110)
* make_package_relative: relocate rpaths on cray * relocate_package: relocate rpaths on cray * platforms: add `binary_formats` property We need to know which binary formats are supported on a platform so we know which types of relocations to try. This adds a list of binary formats to the platform and removes a bunch of special cases from `binary_distribution.py`. Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
parent
525a9f02ca
commit
1b965ac507
4 changed files with 27 additions and 19 deletions
|
@ -233,10 +233,14 @@ class Platform(object):
|
|||
Will return a instance of it once it is returned.
|
||||
"""
|
||||
|
||||
priority = None # Subclass sets number. Controls detection order
|
||||
priority = None # Subclass sets number. Controls detection order
|
||||
|
||||
#: binary formats used on this platform; used by relocation logic
|
||||
binary_formats = ['elf']
|
||||
|
||||
front_end = None
|
||||
back_end = None
|
||||
default = None # The default back end target. On cray ivybridge
|
||||
default = None # The default back end target. On cray ivybridge
|
||||
|
||||
front_os = None
|
||||
back_os = None
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
import tempfile
|
||||
import hashlib
|
||||
import glob
|
||||
import platform
|
||||
|
||||
from contextlib import closing
|
||||
import ruamel.yaml as yaml
|
||||
|
@ -520,16 +519,16 @@ def make_package_relative(workdir, spec, allow_root):
|
|||
for filename in buildinfo['relocate_binaries']:
|
||||
orig_path_names.append(os.path.join(prefix, filename))
|
||||
cur_path_names.append(os.path.join(workdir, filename))
|
||||
if (spec.architecture.platform == 'darwin' or
|
||||
spec.architecture.platform == 'test' and
|
||||
platform.system().lower() == 'darwin'):
|
||||
relocate.make_macho_binaries_relative(cur_path_names, orig_path_names,
|
||||
old_layout_root)
|
||||
if (spec.architecture.platform == 'linux' or
|
||||
spec.architecture.platform == 'test' and
|
||||
platform.system().lower() == 'linux'):
|
||||
relocate.make_elf_binaries_relative(cur_path_names, orig_path_names,
|
||||
old_layout_root)
|
||||
|
||||
platform = spack.architecture.get_platform(spec.platform)
|
||||
if 'macho' in platform.binary_formats:
|
||||
relocate.make_macho_binaries_relative(
|
||||
cur_path_names, orig_path_names, old_layout_root)
|
||||
|
||||
if 'elf' in platform.binary_formats:
|
||||
relocate.make_elf_binaries_relative(
|
||||
cur_path_names, orig_path_names, old_layout_root)
|
||||
|
||||
relocate.raise_if_not_relocatable(cur_path_names, allow_root)
|
||||
orig_path_names = list()
|
||||
cur_path_names = list()
|
||||
|
@ -609,18 +608,16 @@ def is_backup_file(file):
|
|||
]
|
||||
# If the buildcache was not created with relativized rpaths
|
||||
# do the relocation of path in binaries
|
||||
if (spec.architecture.platform == 'darwin' or
|
||||
spec.architecture.platform == 'test' and
|
||||
platform.system().lower() == 'darwin'):
|
||||
platform = spack.architecture.get_platform(spec.platform)
|
||||
if 'macho' in platform.binary_formats:
|
||||
relocate.relocate_macho_binaries(files_to_relocate,
|
||||
old_layout_root,
|
||||
new_layout_root,
|
||||
prefix_to_prefix, rel,
|
||||
old_prefix,
|
||||
new_prefix)
|
||||
if (spec.architecture.platform == 'linux' or
|
||||
spec.architecture.platform == 'test' and
|
||||
platform.system().lower() == 'linux'):
|
||||
|
||||
if 'elf' in platform.binary_formats:
|
||||
relocate.relocate_elf_binaries(files_to_relocate,
|
||||
old_layout_root,
|
||||
new_layout_root,
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
class Darwin(Platform):
|
||||
priority = 89
|
||||
|
||||
binary_formats = ['macho']
|
||||
|
||||
def __init__(self):
|
||||
super(Darwin, self).__init__('darwin')
|
||||
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
import platform
|
||||
from spack.architecture import Platform, Target
|
||||
from spack.architecture import OperatingSystem
|
||||
|
||||
|
||||
class Test(Platform):
|
||||
priority = 1000000
|
||||
|
||||
if platform.system().lower() == 'darwin':
|
||||
binary_formats = ['macho']
|
||||
|
||||
front_end = 'x86'
|
||||
back_end = 'x86_64'
|
||||
default = 'x86_64'
|
||||
|
|
Loading…
Reference in a new issue