【问题标题】:cmake error with grpc in tensorflowtensorflow中grpc的cmake错误
【发布时间】:2018-05-04 13:34:23
【问题描述】:

尝试使用 cmake 构建 tensorflow 时,出现以下错误。我不确定这是否与 tensorflow 或 grpc 有关。知道发生了什么吗?

这是在 Mac OS Sierra 上。

重现步骤:

# clone tensorflow repo
# in tensorflow directory
cd tensorflow/contrib/cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/local/bin/python3
make tf_tutorials_example_trainer

错误:

# ...
Scanning dependencies of target tf_tutorials_example_trainer
[100%] Building CXX object CMakeFiles/tf_tutorials_example_trainer.dir/Users/kevenwang/VirtualBoxShared/another_tf/tensorflow/cc/tutorials/example_trainer.cc.o
[100%] Linking CXX executable tf_tutorials_example_trainer
Undefined symbols for architecture x86_64:
  "_ares_cancel", referenced from:
      on_readable_cb(grpc_exec_ctx*, void*, grpc_error*) in libgrpc_unsecure.a(grpc_ares_ev_driver_posix.cc.o)
      on_writable_cb(grpc_exec_ctx*, void*, grpc_error*) in libgrpc_unsecure.a(grpc_ares_ev_driver_posix.cc.o)
  "_ares_destroy", referenced from:
      grpc_ares_ev_driver_unref(grpc_ares_ev_driver*) in libgrpc_unsecure.a(grpc_ares_ev_driver_posix.cc.o)

  ...

      _grpc_ares_ev_driver_create in libgrpc_unsecure.a(grpc_ares_ev_driver_posix.cc.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [tf_tutorials_example_trainer] Error 1
make[2]: *** [CMakeFiles/tf_tutorials_example_trainer.dir/all] Error 2
make[1]: *** [CMakeFiles/tf_tutorials_example_trainer.dir/rule] Error 2

【问题讨论】:

  • gRPC 确实使用 c-ares 作为第三方依赖,所以这可能确实是 gRPC 的问题,但如果没有更多信息很难判断。考虑在 github 上提交 gRPC 问题,并请提供更多详细信息 - gRPC 版本、它在其他平台上是否工作等。
  • 另外,您可以尝试在禁用 c-ares(定义 GRPC_ARES=0)或在系统上预安装 c-ares(gRPC_CARES_PROVIDER=package cmake 参数)的情况下进行编译

标签: tensorflow cmake grpc


【解决方案1】:

也许你通过 Homebrew 安装了 grpc 库。

在这种情况下,您需要链接 c-ares 库。

例如

TARGET_LINK_LIBRARIES(demo "/usr/local/lib/libcares.a" ...)

【讨论】:

    猜你喜欢
    • 2017-10-11
    • 1970-01-01
    • 2018-06-05
    • 1970-01-01
    • 2020-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多