Skip to content

Commit 0fbfbea

Browse files
jiweibohouj04
andauthored
resolve #30141 (#30145) (#30345)
fix compile problem on FT Co-authored-by: houj04 <35131887+houj04@users.noreply.github.com>
1 parent 9d0a1eb commit 0fbfbea

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmake/external/lite.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
6565
GIT_REPOSITORY "${GIT_URL}/PaddlePaddle/Paddle-Lite.git"
6666
GIT_TAG ${LITE_GIT_TAG}
6767
PREFIX ${LITE_SOURCES_DIR}
68-
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
68+
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
6969
UPDATE_COMMAND ""
7070
BUILD_COMMAND ${LITE_BUILD_COMMAND}
7171
INSTALL_COMMAND ""

python/setup.py.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ else:
278278
# copy the openblas.dll
279279
shutil.copy('${OPENBLAS_SHARED_LIB}', libs_path)
280280
package_data['paddle.libs'] += ['openblas' + ext_name]
281+
elif os.name == 'posix' and platform.machine() == 'aarch64':
282+
# copy the libopenblas.so on linux+aarch64
283+
# special: core_noavx.so depends on 'libopenblas.so.0', not 'libopenblas.so'
284+
shutil.copy('${OPENBLAS_LIB}' + '.0', libs_path)
285+
package_data['paddle.libs'] += ['libopenblas.so.0']
281286

282287
if '${WITH_LITE}' == 'ON':
283288
shutil.copy('${LITE_SHARED_LIB}', libs_path)
@@ -350,10 +355,8 @@ if '${CMAKE_BUILD_TYPE}' == 'Release':
350355
command = "install_name_tool -id \"@loader_path/../libs/\" ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so'
351356
else:
352357
command = "patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so'
353-
# The dynamic library compiled under aarch64 is greater than 64M,
354-
# and an oversize error will be reported when using patchelf.
355358
# The sw_64 not suppot patchelf, so we just disable that.
356-
if platform.machine() != 'aarch64' and platform.machine() != 'sw_64' and platform.machine() != 'mips64':
359+
if platform.machine() != 'sw_64' and platform.machine() != 'mips64':
357360
if os.system(command) != 0:
358361
raise Exception("patch ${FLUID_CORE_NAME}.%s failed, command: %s" % (ext_name, command))
359362

0 commit comments

Comments
 (0)