【问题标题】:can't MAKE tensorflow Raspberry pi examples无法制作 tensorflow Raspberry pi 示例
【发布时间】:2018-01-04 19:45:10
【问题描述】:

我在 Raspberry Pi 3 上安装了 tensorflow,运行 Jessie,并通过 .whl 文件/python 2.7 的 pip 安装两种方式完成。:

https://github.com/samjabrahams/tensorflow-on-raspberry-pi

以及完整编译通过:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile

两次安装(我在不同的操作系统映像上进行)都成功并且没有错误地完成。

接下来,我想从 tensorflow 的 git 存储库中编译官方的 Raspberry Pi 示例:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/pi_examples

但是,没有一个示例可以编译(无论是相机示例还是图像识别),都给出了相同的错误,Google 也没有告诉我任何信息:

make -f tensorflow/contrib/pi_examples/camera/Makefile gcc --std=c++11
-O0 -I/usr/local/include -I. -I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/downloads
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/downloads/eigen/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/gen/proto/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/gen/proto_text/
-c tensorflow/contrib/pi_examples/camera/camera.cc -o /home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o
In file included from ./tensorflow/core/platform/mutex.h:31:0,
                 from ./tensorflow/core/framework/variant.h:31,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from tensorflow/contrib/pi_examples/camera/camera.cc:33:
./tensorflow/core/platform/default/mutex.h:25:22: fatal error:
nsync_cv.h: No such file or directory  #include "nsync_cv.h"
                      ^ compilation terminated. tensorflow/contrib/pi_examples/camera/Makefile:80: recipe for target
'/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o'
failed make: ***
[/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o]
Error 1

还有:

make -f tensorflow/contrib/pi_examples/label_image/Makefile gcc
--std=c++11 -O0 -I/usr/local/include -I. -I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/downloads
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/downloads/eigen/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/gen/proto/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/gen/proto_text/
-c tensorflow/contrib/pi_examples/label_image/label_image.cc -o /home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/gen/obj/tensorflow/contrib/pi_examples/label_image/label_image.o
In file included from ./tensorflow/core/platform/mutex.h:31:0,
                 from ./tensorflow/core/framework/variant.h:31,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from tensorflow/contrib/pi_examples/label_image/label_image.cc:33:
./tensorflow/core/platform/default/mutex.h:25:22: fatal error:
nsync_cv.h: No such file or directory  #include "nsync_cv.h"
                      ^ compilation terminated. tensorflow/contrib/pi_examples/label_image/Makefile:79: recipe for
target
'/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/gen/obj/tensorflow/contrib/pi_examples/label_image/label_image.o'
failed make: ***
[/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/gen/obj/tensorflow/contrib/pi_examples/label_image/label_image.o]
Error 1

如何定位/添加/编译“nsync_cv.h”? 顺便说一句:

export HOST_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh`

给我:

g++ -M -std=c++11 -DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11
-I../../platform/c++11 -I../../platform/gcc -I../../platform/posix -pthread -I../../public -I../../internal ../../internal/*.c ../../testing/*.c ../../platform/c++11/src/nsync_semaphore_mutex.cc
../../platform/c++11/src/per_thread_waiter.cc
../../platform/c++11/src/yield.cc
../../platform/c++11/src/time_rep_timespec.cc
../../platform/c++11/src/nsync_panic.cc \
          ../../platform/c++11/src/start_thread.cc > dependfile make: 'nsync.a' is up to date.

【问题讨论】:

  • 运行find / -type f -name nsync_cv.h 2>/dev/null。输出是什么? (即,您的系统上是否存在所需的头文件?)
  • 我得到了这个:/home/pi/tensorflow/tensorflow/contrib/makefile/downloads/nsync/public/nsync_cv.h 也许,我家目录中的 tensorflow 目录有问题?跨度>

标签: tensorflow makefile raspberry-pi


【解决方案1】:

我曾经在 nvidia Jetson TX1 上使用 makefile 编译过 tensorflow,我可以通过在示例的 Makefile 中添加一些行来编译和运行示例:

  1. 第 18 行之后:

    NSYNCLIBDIR := $(TFMAKEFILE_DIR)/downloads/nsync/builds/default.linux.c++11 !!!将文件夹 default.linux.c++11 更改为您的 libnsync.a 所在的位置!!!

    NSYNCLIBS := $(NSYNCLIBDIR)/libnsync.a

  2. 第 26 行之后:

    NSYNC := $(TFMAKEFILE_DIR)/downloads/nsync/public/

  3. 第 36 行之后:

    -L$(NSYNCLIBDIR) \

  4. 第 43 行之后:

    -I$(NSYNC) \

  5. 第 51 行之后:

    -lnsync \

  6. 将第 72 行更改为:

    $(EXECUTABLE_NAME): $(EXECUTABLE_OBJS) $(TFLIBS) $(NSYNCLIBS)

希望它适用于这种变化,祝你好运:)

【讨论】:

  • edit这个问题并清理格式以使其更具可读性。
猜你喜欢
  • 2021-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多