From c285ea1ad42c3320fec30175a20992c02ef1a30a Mon Sep 17 00:00:00 2001 From: Yifan Zhao <yifanz16@illinois.edu> Date: Tue, 30 Mar 2021 17:09:25 -0500 Subject: [PATCH] Fixed linking of "libxxx.so" in approxhpvm.py --- hpvm/tools/py-approxhpvm/main.py.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hpvm/tools/py-approxhpvm/main.py.in b/hpvm/tools/py-approxhpvm/main.py.in index 4b604d172a..7f5459d9e6 100644 --- a/hpvm/tools/py-approxhpvm/main.py.in +++ b/hpvm/tools/py-approxhpvm/main.py.in @@ -111,10 +111,16 @@ def link_hpvm_rt(src_file: PathLike, target_file: PathLike) -> List[str]: def link_binary(src_file: PathLike, target_file: PathLike) -> List[str]: + def drop_suffix(libname: str): + import re + + match = re.match(r"lib(.*)\.so", libname) + return libname if match is None else match.group(1) + linker_dir_flags = [] for path in TRT_LINK_DIRS: linker_dir_flags.extend([f"-L{path}", f"-Wl,-rpath={path}"]) - linker_lib_flags = [f"-l{lib}" for lib in TRT_LINK_LIBS] + linker_lib_flags = [f"-l{drop_suffix(lib)}" for lib in TRT_LINK_LIBS] return [ str(LLVM_BUILD_BIN / "clang++"), str(src_file), str(TRT_PATH), "-o", str(target_file), *linker_dir_flags, *linker_lib_flags -- GitLab