gpt4 book ai didi

raspberry-pi - 如何为 Raspberry Pi 交叉编译 Tensorflow-Lite?

转载 作者:行者123 更新时间:2023-12-05 06:58:21 36 4
gpt4 key购买 nike

我正在尝试为 Raspberry Pi B+ 交叉编译 Tensorflow-Lite。为此,我正在关注 these instructions来自官方网站,它们是:

  1. git clone https://github.com/raspberrypi/tools.git rpi_tools
  2. git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
  3. cd tensorflow_src && ./tensorflow/lite/tools/make/download_dependencies.sh
  4. PATH=../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin:$PATH \ ./tensorflow/lite/tools/make/build_rpi_lib.sh TARGET_ARCH=armv6 (步骤4b for armv6,应该是树莓派B+的架构)

我尝试在 OSX 10.13 上交叉编译,但第一步出现了一些冲突,因为一些文件仅大写字母不同,(我猜)由于 OSX 系统不区分大小写:

  'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_connmark.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_DSCP.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_dscp.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_MARK.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_mark.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_RATEEST.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_rateest.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_TCPMSS.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_tcpmss.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h'

反过来,当尝试运行第 4 步时,我收到此错误:

make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/flatbuffer_conversions.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/op_resolver.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/subgraph.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/tensor_utils.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/error_reporter.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/experimental/resource/resource_variable.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/c/c_api_experimental.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/allocation.o] Error 126

我也尝试在 Ubuntu 18.04 上编译,但是第 4 步给了我错误。错误输出很长但看起来像这样

/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:In function 'void ruy::detail::FinalizeMulParams(construy::MulParams<AccumScalar, DstScalar>&, ruy::ChannelDimension,ruy::Ctx*, ruy::TrMulParams*)':/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:17:error: 'is_trivially_copyable' is not a member of 'std'
static_assert(std::is_trivially_copyable::value, "");^ /home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:57:error: expected primary-expression before '>' token
static_assert(std::is_trivially_copyable::value, "");^ /home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:58:error: '::value' has not been declared
static_assert(std::is_trivially_copyable::value, "");

........................[/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/gather.o]Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target'/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/activations.o'failed make: ***[/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/activations.o]Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target'/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/mfcc.o'failed make: ***[/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/mfcc.o]Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target'/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/cumsum.o'failed make: ***[/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/cumsum.o]Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target'/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/conv.o'failed make: ***[/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/conv.o]Error 1 make: Leaving directory'/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src'

更新

我也做了docker pull tensorflow/tensorflow:latest ,启动 docker 镜像并执行相同的命令,但即使页面说它是在该 docker 镜像上测试的,仍然存在错误。

最佳答案

对于 32 位构建:

  1. 检查 Raspberry Pi B+ 的架构。
    $ lscpu
    或者
    $ uname -a
  2. PATH=../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin:$PATH
    ./tensorflow/lite/tools/make/build_rpi_lib.sh TARGET_ARCH=(指定目标架构,即 Raspberry Pi B+)

对于 64 位构建: https://www.tensorflow.org/lite/guide/build_arm64

关于raspberry-pi - 如何为 Raspberry Pi 交叉编译 Tensorflow-Lite?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64647466/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com