Skip to content

Commit 19d6210

Browse files
authored
New variant fix_rt_linkage for intel-oneapi-compilers to fix missing symbols in libimf.so/libirc.so (spack#4092)
* Add variant fix_rt_linkage to intel-oneapi-compilers, run patchelf on libimf.so and libirc.so during the installation of intel-oneapi-runtime to add the missing symbols from libm.so.6 and libc.so.6 * [@spackbot] updating style on behalf of climbfuji --------- Co-authored-by: climbfuji <climbfuji@users.noreply.github.com>
1 parent ad844aa commit 19d6210

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

repos/spack_repo/builtin/packages/intel_oneapi_compilers/package.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ def _standard_flag(self, *, language, standard):
470470
variant("amd", default=False, description="Install AMD plugin for OneAPI")
471471
conflicts("@:2022.2.1", when="+amd", msg="Codeplay AMD plugin requires newer release")
472472

473+
variant(
474+
"fix_rt_linkage",
475+
default=False,
476+
description="Fix unresolved symbols from libc/libm in runtime libraries libirc/libimf",
477+
)
478+
473479
depends_on("gcc languages=c,c++", type="run")
474480

475481
for v in versions:

repos/spack_repo/builtin/packages/intel_oneapi_runtime/package.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class IntelOneapiRuntime(Package):
2323
tags = ["runtime"]
2424

2525
depends_on("intel-oneapi-compilers", type="build")
26+
depends_on("patchelf", when="^intel-oneapi-compilers +fix_rt_linkage", type="build")
2627
depends_on("gcc-runtime", type="link")
2728

2829
LIBRARIES = [
@@ -59,6 +60,19 @@ def install(self, spec, prefix):
5960
for path, name in libraries:
6061
install(path, os.path.join(prefix.lib, os.path.basename(name)))
6162

63+
if self.spec["intel-oneapi-compilers"].satisfies("+fix_rt_linkage"):
64+
for _, name in libraries:
65+
if name == "libimf.so":
66+
patchelf = which("patchelf")
67+
patchelf.add_default_arg("--add-needed")
68+
patchelf.add_default_arg("libm.so.6")
69+
patchelf(join_path(prefix.lib, name), fail_on_error=True)
70+
if name in ["libirc.so", "libimf.so"]:
71+
patchelf = which("patchelf")
72+
patchelf.add_default_arg("--add-needed")
73+
patchelf.add_default_arg("libc.so.6")
74+
patchelf(join_path(prefix.lib, name), fail_on_error=True)
75+
6276
@property
6377
def libs(self):
6478
return LibraryList([])

0 commit comments

Comments
 (0)