PaddlePaddle / Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
https://www.paddlepaddle.org.cn/lite
Apache License 2.0
6.89k stars 1.6k forks source link

"树莓派5 编译错误"- v2.13 编译报错、环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux) #10517

Closed hanyuanzhong closed 1 month ago

hanyuanzhong commented 1 month ago

一、问题描述: "树莓派5 编译错误"- v2.13 编译报错、执行uname -a 环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux)

   1)Paddle Lite 版本: v2.13    2)Host 环境:树莓派5、Debian: 12.5----Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux

二、复现步骤如下执行:

2.1:安装cmake:
    1: sudo apt update
    2: sudo apt-get install -y --no-install-recommends \
      gcc g++ make wget python3 unzip patchelf python3-dev

    3: wget https://www.cmake.org/files/v3.10/cmake-3.10.3.tar.gz
    4: tar -zxvf cmake-3.10.3.tar.gz
    5: cd cmake-3.10.3
    6: ./configure
    7: make
    8: sudo make install

2.2:编译 Paddle-Lite
    1: git clone https://github.com/PaddlePaddle/Paddle-Lite.git
    2: cd Paddle-Lite
    3: git checkout release/v2.13
    4: rm -rf third-party
    5: ./lite/tools/build_linux.sh --with_python=ON --with_cv=ON

三、报错如下(截图+ 日志信息): 3.1: image

    /home/pi/myHome/softWare/Paddle-Lite/third-party/protobuf-host/src/google/protobuf/compiler/java/java_file.cc:97:54:   required from here
    /usr/include/c++/12/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
      770 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
          |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/12/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const google::protobuf::compiler::java::{anonymous}::FieldDescriptorCompare&, const google::protobuf::FieldDescriptor* const&, const google::protobuf::FieldDescriptor* const&>’ evaluates to false
    make[6]: *** [CMakeFiles/libprotoc.dir/build.make:1023:CMakeFiles/libprotoc.dir/home/pi/myHome/softWare/Paddle-Lite/third-party/protobuf-host/src/google/protobuf/compiler/java/java_file.cc.o] 错误 1
    make[6]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc/third_party/protobuf_host/src/protobuf_host-build”
    make[5]: *** [CMakeFiles/Makefile2:143:CMakeFiles/libprotoc.dir/all] 错误 2
    make[5]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc/third_party/protobuf_host/src/protobuf_host-build”
    make[4]: *** [Makefile:130:all] 错误 2
    make[4]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc/third_party/protobuf_host/src/protobuf_host-build”
    make[3]: *** [CMakeFiles/protobuf_host.dir/build.make:111:third_party/protobuf_host/src/protobuf_host-stamp/protobuf_host-build] 错误 2
    make[3]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc”
    make[2]: *** [CMakeFiles/Makefile2:68:CMakeFiles/protobuf_host.dir/all] 错误 2
    make[2]: *** 正在等待未完成的任务....

3.2: image

   make[4]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc/third_party/protobuf/src/extern_protobuf-build”
  [ 13%] Completed 'extern_protobuf'
  make[3]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc”
  [ 13%] Built target extern_protobuf
  [ 13%] Building CXX object lite/operators/CMakeFiles/ops.dir/relu_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/io_copy_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/fusion_elementwise_activation_ops.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/io_copy_once_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/dropout_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/layout_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/layout_once_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/instance_norm_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/subgraph_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/grid_sampler_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/flatten_op.cc.o
  [ 14%] Building CXX object lite/operators/CMakeFiles/ops.dir/write_back_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/lod_array_length_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/unbind_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/set_value_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/density_prior_box_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/assign_value_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/slice_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/sequence_topk_avg_pooling_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/search_fc_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/__xpu__spatial_transformer_op.cc.o
  [ 15%] Building CXX object lite/operators/CMakeFiles/ops.dir/op_params.cc.o
  [ 15%] Linking CXX static library libops.a
  make[3]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc”
  [ 15%] Built target ops
  make[2]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc”
  make[1]: *** [CMakeFiles/Makefile2:507:lite/CMakeFiles/publish_inference.dir/rule] 错误 2
  make[1]: 离开目录“/home/pi/myHome/softWare/Paddle-Lite/build.lite.linux.armv8.gcc”
  make: *** [Makefile:261:publish_inference] 错误 2
MuShangCC commented 1 month ago

编译 protobuf 出现 C++17 的报错,可以降低 g++ 版本或者手动添加 const 修饰符。

hanyuanzhong commented 1 month ago

您好,gcc 版本降低到多少比较好呢

---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年05月17日 11:15 | | 收件人 | PaddlePaddle/Paddle-Lite @.> | | 抄送人 | hyz_like_cmm @.>, Author @.> | | 主题 | Re: [PaddlePaddle/Paddle-Lite] "树莓派5 编译错误"- v2.13 编译报错、环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux) (Issue #10517) |

编译 protobuf 出现 C++17 的报错,可以降低 g++ 版本或者手动添加 const 修饰符。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hong19860320 commented 1 month ago

您好,gcc 版本降低到多少比较好呢 ---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年05月17日 11:15 | | 收件人 | PaddlePaddle/Paddle-Lite @.> | | 抄送人 | hyz_like_cmm @.>, Author @.> | | 主题 | Re: [PaddlePaddle/Paddle-Lite] "树莓派5 编译错误"- v2.13 编译报错、环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux) (Issue #10517) | 编译 protobuf 出现 C++17 的报错,可以降低 g++ 版本或者手动添加 const 修饰符。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

我们在 ubuntu 18.04 + gcc7.2 验证是 OK 的,目前有三个方案:1)安装或切换低版本的 GCC;2)刷 18.04 的系统;3)使用我们 release note https://github.com/PaddlePaddle/Paddle-Lite/releases 里面预编译的 paddle lite 动态库。

hanyuanzhong commented 1 month ago

您好,gcc 版本降到多少比较好呢 ---- 回复的原邮件 ---- |发件人 | @**> | |发送日期 | 2024年05月17日 11:15 | |营养 | PaddlePaddle/Paddle-Lite @ .** > | |抄送人 | hyz_likecmm @ . >,作者_@_。 > | |主题 |回复: [PaddlePaddle/Paddle-Lite] "树莓派5 编译错误"- v2.13 编译错误、环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28- 1+rpt1 (2024-04-22) aarch64 GNU/Linux)(问题#10517)|编译 protobuf 出现 C++17 的报错,可以降低 g++ 版本或者手动添加 const 修饰符。 — 直接回复此电子邮件,在 GitHub 上查看,或取消订阅。您收到此消息是因为您创作了该主题。消息 ID:@_ .***>

我们在 ubuntu 18.04 + gcc7.2 验证是OK的,目前有三种方案:1)安装或切换低版本的GCC;2)刷18.04的系统;3)使用我们的release note https://github.com/PaddlePaddle /Paddle-Lite/releases里面预编译的paddle lite动态库。

好的,我试一下降低gcc版本或者手动添加 const 修饰符。 另外,我的树莓派是树莓派5,并且是armv8的架构,然而在预编译的动态库中,我不确定 armv8 是否支持 image

hanyuanzhong commented 1 month ago

手动添加 const 修饰

您好,请教一下,这个const修饰符怎么加的

MuShangCC commented 1 month ago

手动添加 const 修饰

您好,请教一下,这个const修饰符怎么加的

类似这种 image

hanyuanzhong commented 1 month ago

手动添加 const 修饰

您好,请教一下,这个const修饰符怎么加的

类似这种 image

您好,因为我不会c语音,我看这个信息,应该是在下面两个文件里改,然后我不知道在这个地方要怎么加,加在哪个文件,您能帮我解答一下吗:报错及两个代码如下图 image

image

hong19860320 commented 1 month ago

您好,gcc 版本降到多少比较好呢 ---- 回复的原邮件 ---- |发件人 | @**> | |发送日期 | 2024年05月17日 11:15 | |营养 | PaddlePaddle/Paddle-Lite @ .** > | |抄送人 | hyz_likecmm @ . >,作者_@_。 > | |主题 |回复: [PaddlePaddle/Paddle-Lite] "树莓派5 编译错误"- v2.13 编译错误、环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28- 1+rpt1 (2024-04-22) aarch64 GNU/Linux)(问题#10517)|编译 protobuf 出现 C++17 的报错,可以降低 g++ 版本或者手动添加 const 修饰符。 — 直接回复此电子邮件,在 GitHub 上查看,或取消订阅。您收到此消息是因为您创作了该主题。消息 ID:@_ .***>

我们在 ubuntu 18.04 + gcc7.2 验证是OK的,目前有三种方案:1)安装或切换低版本的GCC;2)刷18.04的系统;3)使用我们的release note https://github.com/PaddlePaddle /Paddle-Lite/releases里面预编译的paddle lite动态库。

好的,我试一下降低gcc版本或者手动添加 const 修饰符。 另外,我的树莓派是树莓派5,并且是armv8的架构,然而在预编译的动态库中,我不确定 armv8 是否支持 image

树莓派的系统 abi 是 armhf 还是 arm64 的?

hanyuanzhong commented 1 month ago

您好,gcc 版本降到多少比较好呢 ---- 回复的原邮件 ---- |发件人 | @**> | |发送日期 | 2024年05月17日 11:15 | |营养 | PaddlePaddle/Paddle-Lite @ .** > | |抄送人 | hyz_likecmm @ . >,作者_@_。 > | |主题 |回复: [PaddlePaddle/Paddle-Lite] "树莓派5 编译错误"- v2.13 编译错误、环境信息: (Linux raspberrypi 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28- 1+rpt1 (2024-04-22) aarch64 GNU/Linux)(问题#10517)|编译 protobuf 出现 C++17 的报错,可以降低 g++ 版本或者手动添加 const 修饰符。 — 直接回复此电子邮件,在 GitHub 上查看,或取消订阅。您收到此消息是因为您创作了该主题。消息 ID:@_ .***>

我们在 ubuntu 18.04 + gcc7.2 验证是OK的,目前有三种方案:1)安装或切换低版本的GCC;2)刷18.04的系统;3)使用我们的release note https://github.com/PaddlePaddle /Paddle-Lite/releases里面预编译的paddle lite动态库。

好的,我试一下降低gcc版本或者手动添加 const 修饰符。 另外,我的树莓派是树莓派5,并且是armv8的架构,然而在预编译的动态库中,我不确定 armv8 是否支持 image

树莓派的系统 abi 是 armhf 还是 arm64 的?

是 arm64 的

hong19860320 commented 1 month ago

Raspberry Pi OS 还是 Raspberry Pi OS (64-bit) 系统?如果是 64 位系统,可以用这个试试 image

MuShangCC commented 1 month ago

手动添加 const 修饰

您好,请教一下,这个const修饰符怎么加的

类似这种 image

您好,因为我不会c语音,我看这个信息,应该是在下面两个文件里改,然后我不知道在这个地方要怎么加,加在哪个文件,您能帮我解答一下吗:报错及两个代码如下图 image

image

呃 这个是改java_file.cc 68行 加const 但这种情况下建议还是降 gcc/g++ 版本吧,我不确定是否还有别的问题

liunaqq commented 1 month ago

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

Raspberry Pi OS 还是 Raspberry Pi OS (64-bit) 系统?如果是 64 位系统,可以用这个尝试 图像

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

hanyuanzhong commented 1 month ago

还有 @hong19860320 @MuShangCC 您好,请教一下: 我改完gcc版本之后还是报错: 报错代码如下: image 报错内容如下图 image

hong19860320 commented 1 month ago

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

Raspberry Pi OS 还是 Raspberry Pi OS (64-bit) 系统?如果是 64 位系统,可以用这个尝试 图像

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

如果你不知道怎么用预编译的 c++ paddle lite 库,建议你还是先看下文档 https://www.paddlepaddle.org.cn/lite/v2.12/demo_guides/arm_cpu.html,用 demo 自带的库在板子上跑起来。

liunaqq commented 1 month ago

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

Raspberry Pi OS 还是 Raspberry Pi OS (64-bit) 系统?如果是 64 位系统,可以用这个尝试图像

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

如果你不知道怎么用预编译的c++ paddle lite库,建议你还是先看下文档https://www.paddlepaddle.org.cn/lite/v2.12/demo_guides/arm_cpu.html,用demo自带的库在板子上跑起来。

按照文档选择编译 image 报错如下: image 这是什么情况啊?

csy0225 commented 1 month ago

export CC 设置一下gcc 路径

hong19860320 commented 1 month ago

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

Raspberry Pi OS 还是 Raspberry Pi OS (64-bit) 系统?如果是 64 位系统,可以用这个尝试图像

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

如果你不知道怎么用预编译的c++ paddle lite库,建议你还是先看下文档https://www.paddlepaddle.org.cn/lite/v2.12/demo_guides/arm_cpu.html,用demo自带的库在板子上跑起来。

按照文档选择编译 image 报错如下: image 这是什么情况啊?

不要折腾从源码编译了,先跑通我们文档里面的自带 demo,然后有需求的话再解决源码编译问题。

hong19860320 commented 1 month ago

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

Raspberry Pi OS 还是 Raspberry Pi OS (64-bit) 系统?如果是 64 位系统,可以用这个尝试图像

我也遇到这个问题,我也是arm64,这个下载这个文件后怎么用啊?

如果你不知道怎么用预编译的c++ paddle lite库,建议你还是先看下文档https://www.paddlepaddle.org.cn/lite/v2.12/demo_guides/arm_cpu.html,用demo自带的库在板子上跑起来。

按照文档选择编译 image 报错如下: image 这是什么情况啊?

你这是在本地编译,需要设置一下环境变量。 $ export CC= $ export CXX=<path_to_your_c++_compiler>

例如 $ export CC=/usr/bin/gcc $ export CXX=/usr/bin/g++

hanyuanzhong commented 1 month ago

已经找到原因了,是因为python3.10的setuptools版本(69.5.1)太高了,使用pip install --upgrade setuptools==58.0.4就可以编译通过,但是编译生成的whl安装后版本是cd09a8e,是git的记录值,希望后面的版本能优化一下,兼容新的setuptools值 image

hong19860320 commented 1 month ago

已经找到原因了,是因为python3.10的setuptools版本(69.5.1)太高了,使用pip install --upgrade setuptools==58.0.4就可以编译通过,但是编译生成的whl安装后版本是cd09a8e,是git的记录值,希望后面的版本能优化一下,兼容新的setuptools值 image

好的,我们后续修复一下,一版编译tag 版本就不会有这个问题啦

lsewcx commented 2 weeks ago

在Paddle-Lite/third-party/protobuf-host/src/google/protobuf/compiler/java/java_file.cc中找到FieldDescriptorCompare image