标题: building optimize tool fails with script for RPi 5 and RPi4
版本、环境信息:
1)Paddle Lite 版本:v2.13-rc
2)Host 环境:Debian Bookworm
3)运行设备环境:Raspberry Pi 5
4)预测后端信息:CPU (ARM Cortex-A76)
复现信息:如为报错,请给出复现环境、复现步骤
问题描述:
When using the script to build the optimizer for the Raspberry Pi 5 you face two issues.
1) The latest gcc version 12.2 fails to compile the provide third-party protobuf.
To address this issue, add const at the end of line 68 in
2) The build_linux.sh script is hard coded and fixed for an x86 machine.
When running the script, you get the following output on the terminal:
-- LITE_WITH_X86: ON
-- LITE_WITH_ARM: OFF
-- LITE_WITH_SW: OFF
-- LITE_WITH_OPENCL: OFF
-- LITE_WITH_METAL: OFF
-- LITE_WITH_XPU: OFF
-- LITE_WITH_NNADAPTER: OFF
-- LITE_WITH_PROFILE: OFF
-- LITE_WITH_CV: ON
You need to alter the script to get it working for the Raspberry Pi (or any other aarch64 device other than Android).
Inside build_linux.sh
# 4.2 function of opt
function build_opt {
rm -f $workspace/lite/api/paddle_use_ops.h
rm -f $workspace/lite/api/paddle_use_kernels.h
prepare_thirdparty
build_dir=$workspace/build.opt
rm -rf $build_dir
mkdir -p $build_dir
cd $build_dir
cmake $workspace \
-DARM_TARGET_OS=armlinux \
-DLITE_ON_MODEL_OPTIMIZE_TOOL=ON \
-DWITH_TESTING=OFF \
-DLITE_WITH_X86=OFF \
-DLITE_WITH_ARM=ON \
-DLITE_BUILD_EXTRA=ON \
-DWITH_MKL=OFF
make opt -j$NUM_PROC
}
Now you get
-- LITE_WITH_X86: OFF
-- LITE_WITH_ARM: ON
-- LITE_WITH_SW: OFF
-- LITE_WITH_OPENCL: OFF
-- LITE_WITH_METAL: OFF
-- LITE_WITH_XPU: OFF
-- LITE_WITH_NNADAPTER: OFF
-- LITE_WITH_PROFILE: OFF
-- LITE_WITH_CV: ON
为使您的问题得到快速解决,在建立 Issues 前,请您先通过如下方式搜索是否有相似问题:历史 issue, FAQ 文档, 官方文档
如果您没有查询到相似问题,为快速解决您的提问,建立issue时请提供如下细节信息:
To address this issue, add
const
at the end of line 68 inthrid-party/protobuf-host/src/google/protobuf/compiler/java/java_file.cc
2) The
build_linux.sh
script is hard coded and fixed for an x86 machine. When running the script, you get the following output on the terminal:-- LITE_WITH_X86: ON -- LITE_WITH_ARM: OFF -- LITE_WITH_SW: OFF -- LITE_WITH_OPENCL: OFF -- LITE_WITH_METAL: OFF -- LITE_WITH_XPU: OFF -- LITE_WITH_NNADAPTER: OFF -- LITE_WITH_PROFILE: OFF -- LITE_WITH_CV: ON
You need to alter the script to get it working for the Raspberry Pi (or any other aarch64 device other than Android). Inside
build_linux.sh
Now you get -- LITE_WITH_X86: OFF -- LITE_WITH_ARM: ON -- LITE_WITH_SW: OFF -- LITE_WITH_OPENCL: OFF -- LITE_WITH_METAL: OFF -- LITE_WITH_XPU: OFF -- LITE_WITH_NNADAPTER: OFF -- LITE_WITH_PROFILE: OFF -- LITE_WITH_CV: ON