From 0fbfbeacbec657ec1d9c4697e3a572393c10b27c Mon Sep 17 00:00:00 2001 From: Wilber Date: Wed, 13 Jan 2021 10:25:42 +0800 Subject: [PATCH] resolve #30141 (#30145) (#30345) fix compile problem on FT Co-authored-by: houj04 <35131887+houj04@users.noreply.github.com> --- cmake/external/lite.cmake | 2 +- python/setup.py.in | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmake/external/lite.cmake b/cmake/external/lite.cmake index 385e87f8936..3d9a694c8af 100644 --- a/cmake/external/lite.cmake +++ b/cmake/external/lite.cmake @@ -65,7 +65,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) GIT_REPOSITORY "${GIT_URL}/PaddlePaddle/Paddle-Lite.git" GIT_TAG ${LITE_GIT_TAG} PREFIX ${LITE_SOURCES_DIR} - PATCH_COMMAND mkdir -p ${LITE_SOURCES_DIR}/src/extern_lite-build/lite/gen_code && touch ${LITE_SOURCES_DIR}/src/extern_lite-build/lite/gen_code/__generated_code__.cc + PATCH_COMMAND mkdir -p ${LITE_SOURCES_DIR}/src/extern_lite-build/lite/gen_code && touch ${LITE_SOURCES_DIR}/src/extern_lite-build/lite/gen_code/__generated_code__.cc && sed -i "/aarch64-linux-gnu-gcc/d" ${LITE_SOURCES_DIR}/src/extern_lite/cmake/cross_compiling/armlinux.cmake && sed -i "/aarch64-linux-gnu-g++/d" ${LITE_SOURCES_DIR}/src/extern_lite/cmake/cross_compiling/armlinux.cmake UPDATE_COMMAND "" BUILD_COMMAND ${LITE_BUILD_COMMAND} INSTALL_COMMAND "" diff --git a/python/setup.py.in b/python/setup.py.in index e3517adc194..c4102555637 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -278,6 +278,11 @@ else: # copy the openblas.dll shutil.copy('${OPENBLAS_SHARED_LIB}', libs_path) package_data['paddle.libs'] += ['openblas' + ext_name] + elif os.name == 'posix' and platform.machine() == 'aarch64': + # copy the libopenblas.so on linux+aarch64 + # special: core_noavx.so depends on 'libopenblas.so.0', not 'libopenblas.so' + shutil.copy('${OPENBLAS_LIB}' + '.0', libs_path) + package_data['paddle.libs'] += ['libopenblas.so.0'] if '${WITH_LITE}' == 'ON': shutil.copy('${LITE_SHARED_LIB}', libs_path) @@ -350,10 +355,8 @@ if '${CMAKE_BUILD_TYPE}' == 'Release': command = "install_name_tool -id \"@loader_path/../libs/\" ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so' else: command = "patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so' - # The dynamic library compiled under aarch64 is greater than 64M, - # and an oversize error will be reported when using patchelf. # The sw_64 not suppot patchelf, so we just disable that. - if platform.machine() != 'aarch64' and platform.machine() != 'sw_64' and platform.machine() != 'mips64': + if platform.machine() != 'sw_64' and platform.machine() != 'mips64': if os.system(command) != 0: raise Exception("patch ${FLUID_CORE_NAME}.%s failed, command: %s" % (ext_name, command)) -- GitLab