【发布时间】: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