【发布时间】:2022-11-11 11:36:26
【问题描述】:
我正在尝试在 Macbook M1 上安装 tensorflow 的 C API 以在 Go 中执行它。 tensorflow 开发人员遵循了这个guide,但是在使用这个命令gcc hello_tf.c -ltensorflow -o hello_tf 运行hello_tf.c 文件时卡住了。
这是hello_tf.c 文件
#include <stdio.h>
#include <tensorflow/c/c_api.h>
int main() {
printf("Hello from TensorFlow C library version %s\n", TF_Version());
return 0;
}
这是错误日志:
ld: warning: ignoring file /usr/local/lib/libtensorflow.2.7.0.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_TF_Version", referenced from:
_main in hello_tf-6f1778.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation
关于如何修复编译的任何建议?
【问题讨论】:
标签: c tensorflow go apple-m1 c-api