Skip to content

Commit 0dec970

Browse files
committed
Update run_defaults_diff.py to set runpath in release
1 parent 460576f commit 0dec970

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎test/run_defaults_diff.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@
6969

7070
old_ssc = installations_dirs / "linux_64" / 'ssc.so'
7171

72+
# update runpath of old ssc.so - should be done in the future by the SAM build system, but for now we need to do it manually
73+
# Set your target directory and new runpath
74+
target_dir = Path(installations_dirs / "linux_64")
75+
new_runpath = "$ORIGIN" # Or an absolute path like '/usr/local/lib'
76+
77+
# Loop through all .so files recursively
78+
for so_file in target_dir.glob("**/*.so"):
79+
try:
80+
# Run patchelf to set the rpath/runpath
81+
subprocess.run(
82+
["patchelf", "--set-rpath", new_runpath, str(so_file)], check=True
83+
)
84+
print(f"Successfully updated: {so_file.name}")
85+
except subprocess.CalledProcessError as e:
86+
print(f"Failed to update {so_file.name}: {e}")
87+
88+
7289
ssc_dir = Path(os.environ.get("SSCDIR"))
7390
new_ssc = Path(glob.glob(str(ssc_dir / "build" / "ssc" / "*ssc.so"))[0])
7491

0 commit comments

Comments
 (0)