Fix patchelf problem (#295)

fix patchelf
This commit is contained in:
Jason
2022-09-28 12:33:32 +08:00
committed by GitHub
parent 1fe7ba4a33
commit 7af1fa0946
3 changed files with 13 additions and 2 deletions

View File

@@ -31,6 +31,11 @@ def process_on_linux(current_dir):
if f.count("fastdeploy") and f.count(".so") > 0:
fd_libs.append(filename)
cmake_build_dir = os.path.join(current_dir, ".setuptools-cmake-build")
patchelf_bin_path = os.path.join(cmake_build_dir, "third_libs/patchelf/bin/patchelf")
if not os.path.exists(patchelf_bin_path):
patchelf_bin_path = "patchelf"
third_libs_path = os.path.join(libs_path, "third_libs")
# remove some useless opencv file in python wheels to decrease package size
@@ -58,7 +63,7 @@ def process_on_linux(current_dir):
rpath = "$ORIGIN/" + rel_path
rpaths.append(rpath)
for lib in fd_libs:
command = "patchelf --set-rpath '{}' {}".format(":".join(rpaths), lib)
command = "{} --set-rpath '{}' {}".format(patchelf_bin_path, ":".join(rpaths), lib)
if platform.machine() != 'sw_64' and platform.machine() != 'mips64':
assert subprocess.Popen(
command,