Skip to content

Commit eb5edab

Browse files
committed
re-instate $ORIGIN/../lib and $ORIGIN/../lib64 in RPATH locations injected by RPATH compiler wrapper
1 parent 3470201 commit eb5edab

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

easybuild/framework/easyblock.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,12 +1737,14 @@ def prepare_step(self, start_dir=True):
17371737
if not self.build_in_installdir:
17381738
self.rpath_filter_dirs.append(self.builddir)
17391739

1740-
# always include self.installdir+'/lib' and self.installdir+'/lib64' and $ORIGIN
1740+
# always include '<installdir>/lib', '<installdir>/lib64', $ORIGIN, $ORIGIN/../lib and $ORIGIN/../lib64
17411741
# $ORIGIN will be resolved by the loader to be the full path to the executable or shared object
17421742
# see also https://linux.die.net/man/8/ld-linux;
1743-
self.rpath_include_dirs.append(self.installdir+'/lib')
1744-
self.rpath_include_dirs.append(self.installdir+'/lib64')
1743+
self.rpath_include_dirs.append(os.path.join(self.installdir, 'lib'))
1744+
self.rpath_include_dirs.append(os.path.join(self.installdir, 'lib64'))
17451745
self.rpath_include_dirs.append('$ORIGIN')
1746+
self.rpath_include_dirs.append('$ORIGIN/../lib')
1747+
self.rpath_include_dirs.append('$ORIGIN/../lib64')
17461748

17471749
# prepare toolchain: load toolchain module and dependencies, set up build environment
17481750
self.toolchain.prepare(self.cfg['onlytcmod'], silent=self.silent, rpath_filter_dirs=self.rpath_filter_dirs,

test/framework/toolchain.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,13 @@ def test_rpath_args_script(self):
10651065
"""Test rpath_args.py script"""
10661066
script = find_eb_script('rpath_args.py')
10671067

1068-
rpath_inc = '%(prefix)s/lib,%(prefix)s/lib64,$ORIGIN' % {'prefix': self.test_prefix}
1068+
rpath_inc = ','.join([
1069+
os.path.join(self.test_prefix, 'lib'),
1070+
os.path.join(self.test_prefix, 'lib64'),
1071+
'$ORIGIN',
1072+
'$ORIGIN/../lib',
1073+
'$ORIGIN/../lib64',
1074+
])
10691075

10701076
# simplest possible compiler command
10711077
out, ec = run_cmd("%s gcc '' '%s' -c foo.c" % (script, rpath_inc), simple=False)
@@ -1074,6 +1080,8 @@ def test_rpath_args_script(self):
10741080
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
10751081
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
10761082
"'-Wl,-rpath=$ORIGIN'",
1083+
"'-Wl,-rpath=$ORIGIN/../lib'",
1084+
"'-Wl,-rpath=$ORIGIN/../lib64'",
10771085
"'-Wl,--disable-new-dtags'",
10781086
"'-c'",
10791087
"'foo.c'",
@@ -1083,15 +1091,12 @@ def test_rpath_args_script(self):
10831091
# linker command, --enable-new-dtags should be replaced with --disable-new-dtags
10841092
out, ec = run_cmd("%s ld '' '%s' --enable-new-dtags foo.o" % (script, rpath_inc), simple=False)
10851093
self.assertEqual(ec, 0)
1086-
expected = '\n'.join([
1087-
"CMD_ARGS=('foo.o')",
1088-
"RPATH_ARGS='--disable-new-dtags -rpath=%(prefix)s/lib -rpath=%(prefix)s/lib64 -rpath=$ORIGIN'" %
1089-
{'prefix': self.test_prefix},''
1090-
])
10911094
cmd_args = [
10921095
"'-rpath=%s/lib'" % self.test_prefix,
10931096
"'-rpath=%s/lib64'" % self.test_prefix,
10941097
"'-rpath=$ORIGIN'",
1098+
"'-rpath=$ORIGIN/../lib'",
1099+
"'-rpath=$ORIGIN/../lib64'",
10951100
"'--disable-new-dtags'",
10961101
"'--disable-new-dtags'",
10971102
"'foo.o'",
@@ -1105,6 +1110,8 @@ def test_rpath_args_script(self):
11051110
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
11061111
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
11071112
"'-Wl,-rpath=$ORIGIN'",
1113+
"'-Wl,-rpath=$ORIGIN/../lib'",
1114+
"'-Wl,-rpath=$ORIGIN/../lib64'",
11081115
"'-Wl,--disable-new-dtags'",
11091116
]
11101117
self.assertEqual(out.strip(), "CMD_ARGS=(%s)" % ' '.join(cmd_args))
@@ -1116,6 +1123,8 @@ def test_rpath_args_script(self):
11161123
"'-rpath=%s/lib'" % self.test_prefix,
11171124
"'-rpath=%s/lib64'" % self.test_prefix,
11181125
"'-rpath=$ORIGIN'",
1126+
"'-rpath=$ORIGIN/../lib'",
1127+
"'-rpath=$ORIGIN/../lib64'",
11191128
"'--disable-new-dtags'",
11201129
"''",
11211130
]
@@ -1128,6 +1137,8 @@ def test_rpath_args_script(self):
11281137
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
11291138
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
11301139
"'-Wl,-rpath=$ORIGIN'",
1140+
"'-Wl,-rpath=$ORIGIN/../lib'",
1141+
"'-Wl,-rpath=$ORIGIN/../lib64'",
11311142
"'-Wl,--disable-new-dtags'",
11321143
"'-Wl,-rpath=/foo'",
11331144
"'foo.c'",
@@ -1143,6 +1154,8 @@ def test_rpath_args_script(self):
11431154
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
11441155
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
11451156
"'-Wl,-rpath=$ORIGIN'",
1157+
"'-Wl,-rpath=$ORIGIN/../lib'",
1158+
"'-Wl,-rpath=$ORIGIN/../lib64'",
11461159
"'-Wl,--disable-new-dtags'",
11471160
"'foo.c'",
11481161
"'-L../lib'",
@@ -1157,6 +1170,8 @@ def test_rpath_args_script(self):
11571170
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
11581171
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
11591172
"'-Wl,-rpath=$ORIGIN'",
1173+
"'-Wl,-rpath=$ORIGIN/../lib'",
1174+
"'-Wl,-rpath=$ORIGIN/../lib64'",
11601175
"'-Wl,--disable-new-dtags'",
11611176
"'-Wl,-rpath=/foo'",
11621177
"'foo.c'",
@@ -1172,6 +1187,8 @@ def test_rpath_args_script(self):
11721187
"'-rpath=%s/lib'" % self.test_prefix,
11731188
"'-rpath=%s/lib64'" % self.test_prefix,
11741189
"'-rpath=$ORIGIN'",
1190+
"'-rpath=$ORIGIN/../lib'",
1191+
"'-rpath=$ORIGIN/../lib64'",
11751192
"'--disable-new-dtags'",
11761193
"'-rpath=/foo'",
11771194
"'-rpath=/lib64'",
@@ -1194,6 +1211,8 @@ def test_rpath_args_script(self):
11941211
"'-rpath=%s/lib'" % self.test_prefix,
11951212
"'-rpath=%s/lib64'" % self.test_prefix,
11961213
"'-rpath=$ORIGIN'",
1214+
"'-rpath=$ORIGIN/../lib'",
1215+
"'-rpath=$ORIGIN/../lib64'",
11971216
"'--disable-new-dtags'",
11981217
"'-rpath=/lib64'",
11991218
"'-L/foo'",
@@ -1228,6 +1247,8 @@ def test_rpath_args_script(self):
12281247
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
12291248
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
12301249
"'-Wl,-rpath=$ORIGIN'",
1250+
"'-Wl,-rpath=$ORIGIN/../lib'",
1251+
"'-Wl,-rpath=$ORIGIN/../lib64'",
12311252
"'-Wl,--disable-new-dtags'",
12321253
"'-Wl,-rpath=/icc/lib/intel64'",
12331254
"'-Wl,-rpath=/imkl/lib'",
@@ -1271,6 +1292,8 @@ def test_rpath_args_script(self):
12711292
"'-Wl,-rpath=%s/lib'" % self.test_prefix,
12721293
"'-Wl,-rpath=%s/lib64'" % self.test_prefix,
12731294
"'-Wl,-rpath=$ORIGIN'",
1295+
"'-Wl,-rpath=$ORIGIN/../lib'",
1296+
"'-Wl,-rpath=$ORIGIN/../lib64'",
12741297
"'-Wl,--disable-new-dtags'",
12751298
"'-DHAVE_CONFIG_H'",
12761299
"'-I.'",

0 commit comments

Comments
 (0)