Skip to content

Commit

Permalink
Merge pull request #16 from boegel/20230603142755_new_pr_Rust1700
Browse files Browse the repository at this point in the history
fix sysroot patch for Rust 1.70.0
  • Loading branch information
Micket committed Jun 4, 2023
2 parents 9f7c389 + d96917d commit 181250b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions easybuild/easyconfigs/r/Rust/Rust-1.70.0-GCCcore-12.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ source_urls = ['https://static.rust-lang.org/dist/']
sources = ['rustc-%(version)s-src.tar.gz']
patches = ['Rust-1.70_sysroot-fix-interpreter.patch']
checksums = [
{'rustc-%(version)s-src.tar.gz': 'b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c'},
{'Rust-1.70_sysroot-fix-interpreter.patch': '72bffa54837d1a2a117ad63c16deb4078a56a3d9d4f4cbc7430d68dd4cb3effc'},
{'rustc-1.70.0-src.tar.gz': 'b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c'},
{'Rust-1.70_sysroot-fix-interpreter.patch': '220129db55e022a98d25028da5dcc9f26b252dd995c3ac92f6312dbb1e362cb1'},
]

builddependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required
author: Kenneth Hoste (HPC-UGent)
updated by: micketeer@gmail.com

--- src/bootstrap/bootstrap.py.orig 2023-06-03 14:29:59.905599698 +0200
+++ src/bootstrap/bootstrap.py 2023-06-03 14:51:45.781307274 +0200
--- rustc-1.70.0-src.orig/src/bootstrap/bootstrap.py 2023-05-31 21:28:10.000000000 +0200
+++ rustc-1.70.0-src/src/bootstrap/bootstrap.py 2023-06-04 14:15:39.784929373 +0200
@@ -481,6 +481,10 @@
if self._should_fix_bins_and_dylibs is not None:
return self._should_fix_bins_and_dylibs
Expand All @@ -21,21 +21,23 @@ updated by: micketeer@gmail.com
def get_answer():
default_encoding = sys.getdefaultencoding()
try:
@@ -531,6 +535,18 @@
@@ -531,6 +535,20 @@
assert self._should_fix_bins_and_dylibs is True
print("attempting to patch", fname)

+ sysroot = os.getenv("EASYBUILD_SYSROOT")
+ if sysroot and not fname.endswith(".so"):
+ # determine patch to interpreter in host via output produced by 'file -b /bin/bash'
+ readelf_out = subprocess.check_output(['readelf', '-l', '/bin/bash']).decode('ascii', 'ignore').strip()
+ regex = re.compile('.*program interpreter: ([^\]]+)', re.M)
+ res = regex.search(readelf_out)
+ interpreter_path = os.path.join(sysroot, res.group(1).lstrip('/'))
+ if not os.path.exists(interpreter_path):
+ raise Exception("Derived path to interpreter does not exist: %s" % interpreter_path)
+ cmd = ["patchelf", "--set-interpreter", interpreter_path, fname]
+ run(cmd, verbose=True)
+ easybuild_sysroot = os.getenv("EASYBUILD_SYSROOT")
+ if easybuild_sysroot:
+ if not fname.endswith(".so"):
+ # determine patch to interpreter in host via output produced by 'readelf -l /bin/bash'
+ readelf_out = subprocess.check_output(['readelf', '-l', '/bin/bash']).decode('ascii', 'ignore').strip()
+ regex = re.compile('.*program interpreter: ([^\]]+)', re.M)
+ res = regex.search(readelf_out)
+ interpreter_path = os.path.join(easybuild_sysroot, res.group(1).lstrip('/'))
+ if not os.path.exists(interpreter_path):
+ raise Exception("Derived path to interpreter does not exist: %s" % interpreter_path)
+ cmd = ["patchelf", "--set-interpreter", interpreter_path, fname]
+ run(cmd, verbose=True)
+ return
+
# Only build `.nix-deps` once.
nix_deps_dir = self.nix_deps_dir
Expand Down

0 comments on commit 181250b

Please sign in to comment.