我试图在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;
}
这是错误日志(log):
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
关于如何修复编译有什么建议吗?