Ubuntu 16.04中用bazel交叉编译tensorflow lite

2023-05-16

首先在csdn上着了大神关于这个的实践如下链接

https://www.cnblogs.com/jojodru/p/7744630.html

但是报错如下,说是找不到opt选项。

 

INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt
ERROR: Config value opt is not defined in any .rc file
INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt
ERROR: Config value opt is not defined in any .rc file
INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt
ERROR: Config value opt is not defined in any .rc file
INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt
ERROR: Config value opt is not defined in any .rc file
INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt
ERROR: Config value opt is not defined in any .rc file
INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt
ERROR: Config value opt is not defined in any .rc file

INFO: Reading rc options for 'build' from /home/allen/project/tensorflow180711/tools/bazel.rc:
  'build' options: --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --spawn_strategy=standalone --genrule_strategy=standalone -c opt

ERROR: Config value opt is not defined in any .rc file

由于对bazel不熟悉所以着了一篇介绍bazel的文章

https://blog.csdn.net/elaine_bao/article/details/78668657

此文介绍了bazel的基本工作原理,比较有用的一个命令是

bazel query --nohost_deps --noimplicit_deps 'deps(//main:hello-world)' \

--output graph

这个命令可以用来看编译的文件依赖图。

 

在编译lite的时候会编译python,这时候会导致一些错误如下:

/home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -nostdinc '-mfloat-abi=hard' '-mfpu=neon-vfpv4' -funsafe-math-optimizations -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/include -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/usr/include -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot/usr/include -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/4.9.3/include -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.3 -isystem /home/allen/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.3/arm-linux-gnueabihf -U_FORTIFY_SOURCE -fstack-protector -fPIE '-fdiagnostics-color=always' -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O3 -DNDEBUG -ffunction-sections -fdata-sections -MD -MF bazel-out/armv6-opt/bin/external/gif_archive/_objs/gif/external/gif_archive/lib/gifalloc.pic.d -fPIC -iquote external/gif_archive -iquote bazel-out/armv6-opt/genfiles/external/gif_archive -iquote external/bazel_tools -iquote bazel-out/armv6-opt/genfiles/external/bazel_tools -isystem external/gif_archive/lib -isystem bazel-out/armv6-opt/genfiles/external/gif_archive/lib -isystem bazel-out/armv6-opt/bin/external/gif_archive/lib -fPIC '-march=armv6' '-mfloat-abi=hard' '-mfpu=neon-vfpv4' -funsafe-math-optimizations -Wno-unused-function -Wno-sign-compare -I -ftree-vectorize -fomit-frame-pointer armv6 -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/gif_archive/lib/gifalloc.c -o bazel-out/armv6-opt/bin/external/gif_archive/_objs/gif/external/gif_archive/lib/gifalloc.pic.o)

 

可以通过修改编译目标来避免编译python

修改编译目标为 tensorflow:libtensorflow_framework.so

修改build_armv6.sh 增加-I编译选项。来避免下面的错误

ERROR: /home/allen/.cache/bazel/_bazel_allen/b3dc72c6218ef3f1c992e04386ed352b/external/png_archive/BUILD.bazel:8:1: C++ compilation of rule '@png_archive//:png' failed (Exit 1): gcc failed: error executing command

  (cd /home/allen/.cache/bazel/_bazel_allen/b3dc72c6218ef3f1c992e04386ed352b/execroot/org_tensorflow && \

  exec env - \

    PATH=/home/allen/bin:/home/allen/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/allen/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:/home/allen/bin \

    PWD=/proc/self/cwd \

  /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=2' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -isystem /usr/include -g0 -O3 -DNDEBUG -ffunction-sections -fdata-sections -MD -MF bazel-out/host/bin/external/png_archive/_objs/png/external/png_archive/pngpread.d -iquote external/png_archive -iquote bazel-out/host/genfilesexternal/png_archive -iquote external/zlib_archive -iquote bazel-out/host/genfiles/external/zlib_archive -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -isystem external/png_archive -isystem bazel-out/host/genfiles/external/png_archive -isystem bazel-out/host/bin/external/png_archive -isystem external/zlib_archive -isystem bazel-out/host/genfiles/external/zlib_archive -isystem bazel-out/host/bin/external/zlib_archive -g0 '-march=native' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/png_archive/pngpread.c -o bazel-out/host/bin/external/png_archive/_objs/png/external/png_archive/pngpread.o)

In file included from ——:

external/png_archive/pngpriv.h:911:4: error: #error ZLIB_VERNUM != PNG_ZLIB_VERNUM "-I (include path) error: see the notes in pngpriv.h"

#  error ZLIB_VERNUM != PNG_ZLIB_VERNUM \

    ^

INFO: Elapsed time: 558.417s, Critical Path: 13.79s

INFO: 999 processes: 999 local.

FAILED: Build did NOT complete successfully

这样就可以编译完成。

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ubuntu 16.04中用bazel交叉编译tensorflow lite 的相关文章

随机推荐

  • 一个跨平台的 C++ 内存泄漏检测器(转载)

    一个跨平台的 C 43 43 内存泄漏检测器 吴咏炜 adah 64 netstd com 2004 年 3 月 内存泄漏对于C C 43 43 程序员来说也可以算作是个永恒的话题了吧 在Windows下 xff0c MFC的一个很有用的功
  • printf和wprintf、printf输出结束标识符、c++按值返回临时对象是否是const的实验

    ifndef TEST H define TEST H include lt iostream gt include lt string gt using namespace std int x 61 5 struct s public s
  • 自己搭深度学习环境踩坑血泪史

    自己搭深度学习环境踩坑的血泪史 从一个沮丧的事情开始问题1 强行更新了一次win10后 双系统里的ubuntu的启动项就没了 xff0c 直接进入win10系统问题2 sudo apt get update 总是超时问题3 conda in
  • 电脑串口延迟/缓冲设置方法

    使用串口做精确信号发送的时候会经常出现不能时间不精确的问题 xff0c 使用两个u口转串口串连之后一个接收一个发送的情况下 收到的时间延迟数据如下 xff1a 注意 xff1a 这里的因为有一个接收缓冲区和一个发送缓冲区 xff0c 所以这
  • apt-get install 连同诸多依赖包一并安装的指令

    apt get install 连同诸多依赖包一并安装 如题 xff0c apt get安装某个包的时候 xff0c 经常会碰到很多依赖包 xff0c 需要一一安装了才行 xff0c 非常麻烦 当然 xff0c 可以使用以下指令一步到位 a
  • git 分支操作记录

    查看分支 xff1a 查看本地分支 xff1a git branch 查看远程分支 xff1a git branch r 查看全部分支 xff08 本地和远程 xff09 git branch a 新建分支 xff1a 创建新分支 xff1
  • C++ 简析容器Vector

    向量 xff08 Vector xff09 是一个封装了动态大小数组的顺序容器 xff08 Sequence Container xff09 跟任意其它类型容器一样 xff0c 它能够存放各种类型的对象 可以简单的认为 xff0c 向量是一
  • SLAM初始化

    本节的学习要点 xff1a 初始化的目的 单目 双目 初始化的两种方法初始化过程 初始化的目的 单目SLAM初始化的目的是 61 61 构建初始的三维点云地图 xff08 空间点 xff09 并为之后的计算提供初始值 61 61 由于仅从单
  • tensorflow lite example label_image 分析【二】

    接上文 3 代码分析 main函数首先将入参写入参数结构体 Settings s struct Settings bool verbose 61 false bool accel 61 false bool input floating 6
  • 利用Kalibr标定双目相机与IMU

    本文介绍如何利用Kalibr标定工具进行双目相机与IMU的联合标定 主要过程包括以下四步 xff1a 生成标定板标定双目相机标定IMU联合标定 1 生成标定板 使用AprilTag rosrun kalibr kalibr create t
  • FreeRTOS常见知识点

    FreeRTOS常见知识点 1 临界段代码 临界段代码也叫做临界区 xff0c 是指那些必须完整运行 xff0c 不能被打断的代码段 xff0c 比如某些外设的初始化需要严格的时序 xff0c 且不能被打断 FreeRTOS提供的解决方案是
  • linux ssh 登录报hosts错误

    问题分析 问题在于 xff1a Users liuhanlin ssh known hosts xff0c 这个目录中纪录了你之前机器的配置 如果你更换了系统 xff0c 并且重新绑定了密钥 就会出现这个hosts的报错 解决方法 cd U
  • linux内核-进程的调度与切换

    在多进程的操作系统中 xff0c 进程调度是一个全局性的 关键性的问题 xff0c 它对系统的总体设计 系统的实现 功能设置以及各个方面的性能都有着决定性的影响 根据调度结果所做的进程切换的速度 xff0c 也是衡量一个操作系统性能的重要指
  • STM32芯片VDD、VDDA和VREF的关系

    今天碰到一个48pin stm32F103CBT6芯片 xff0c AD参考电压输入引脚的问题 通过cubemx查看引脚 xff0c 发现没有VREF引脚 xff0c 只有VDD 和VDDA电压输入 xff1b 通过查资料和手册 xff0c
  • RTSP的WEB播放方案Streamedian

    因项目需要 xff0c 查找rtsp视频流web播放方法 xff0c 这是文档 原文文档连接 xff1a https streamedian com docs Streamedian是一个 Javascript 库 xff0c 它实现了 R
  • 解决UnsatisfiedLinkError: Unable to load library:Native library not found in resource path

    span class hljs keyword public span span class hljs class span class hljs keyword class span span class hljs title Test
  • TM4C123系列ARM单片机开发入门介绍

    初学TM4C123GH6PZ 以前未接触过ARM 所以感觉一头雾水 根据自己以前C51的简单经验 xff0c 对照资料很少的ARM4教程 摸索着终于明白了开发流程 xff0c 从软件到硬件用自己的程序点亮了LED 现将自己的学习过程记录下来
  • Kinect For Windows SDK 2.0的解读之《KinectV2开发手册》

    转载自 自己的博客 xff0c 由于百度迟迟没有收录 xff0c 在这里转发 Kinect For Windows SDK 2 0的解读之一 开发手册 这二天在外面出差 xff0c 回来才发现26号早晨微软已经通知我可以下载最新的SDK了
  • 使用QZXing识别图片二维码

    欢迎访问http brightguo com 试了下QZXing这个识别二维码库 xff0c 下载地址 xff1a 百度网盘 CSDN下载链接 本站下载连接 在github上下载qzxing xff08 https github com z
  • Ubuntu 16.04中用bazel交叉编译tensorflow lite

    首先在csdn上着了大神关于这个的实践如下链接 https www cnblogs com jojodru p 7744630 html 但是报错如下 xff0c 说是找不到opt选项 INFO Reading rc options for