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

@@ -440,6 +440,12 @@ install(
DIRECTORY ${PROJECT_SOURCE_DIR}/examples DIRECTORY ${PROJECT_SOURCE_DIR}/examples
DESTINATION ${CMAKE_INSTALL_PREFIX} DESTINATION ${CMAKE_INSTALL_PREFIX}
) )
if(NOT WIN32)
install(
FILES ${PROJECT_SOURCE_DIR}/scripts/fastdeploy_init.sh
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
endif()
if(BUILD_FASTDEPLOY_PYTHON) if(BUILD_FASTDEPLOY_PYTHON)
add_definitions(-DBUILD_FASTDEPLOY_PYTHON) add_definitions(-DBUILD_FASTDEPLOY_PYTHON)

View File

@@ -17,7 +17,7 @@ endfunction()
function(download_and_decompress url filename decompress_dir) function(download_and_decompress url filename decompress_dir)
if(NOT EXISTS ${filename}) if(NOT EXISTS ${filename})
message("Downloading file from ${url} to ${filename} ...") message("Downloading file from ${url} to ${filename} ...")
file(DOWNLOAD ${url} "${filename}.tmp") file(DOWNLOAD ${url} "${filename}.tmp" SHOW_PROGRESS)
file(RENAME "${filename}.tmp" ${filename}) file(RENAME "${filename}.tmp" ${filename})
endif() endif()
if(NOT EXISTS ${decompress_dir}) if(NOT EXISTS ${decompress_dir})

View File

@@ -31,6 +31,11 @@ def process_on_linux(current_dir):
if f.count("fastdeploy") and f.count(".so") > 0: if f.count("fastdeploy") and f.count(".so") > 0:
fd_libs.append(filename) 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") third_libs_path = os.path.join(libs_path, "third_libs")
# remove some useless opencv file in python wheels to decrease package size # 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 rpath = "$ORIGIN/" + rel_path
rpaths.append(rpath) rpaths.append(rpath)
for lib in fd_libs: 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': if platform.machine() != 'sw_64' and platform.machine() != 'mips64':
assert subprocess.Popen( assert subprocess.Popen(
command, command,