Tensorflow c_api link issue

Hi everyone,

I am trying to compile the hello_tf.c example given below on an intel MBP, macOS 11.4

#include <stdio.h>
#include <tensorflow/c/c_api.h>

int main() {
  printf("Hello from TensorFlow C library version %s\n", TF_Version());
  return 0;
}

I have first tried to use the TensorFlow-metal python environment. It gives a linkage issue:

ld: warning: dylib (/Users/mathieu/tensorflow-metal/lib/python3.8/site-packages/tensorflow/libtensorflow_framework.2.5.0.dylib) was built for newer macOS version (12.0) than being linked (11.0)

Undefined symbols for architecture x86_64: "_TF_Version", referenced from: _main in main.cpp.o

I then tried to use the framework 2.4 from tensorflow_macos but I get the same issue with that warning:

ld: warning: dylib (/Users/mathieu/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/libtensorflow_framework.2.4.0.dylib) was built for newer macOS version (11.2) than being linked (11.0)

I wonder how to get compilation fixed.

Thanks

To compile this, I believe you need to install the tensorflow c library package as described here:

https://www.tensorflow.org/install/lang_c

and then link against libtensorflow.2.5.0.dylib and not libtensorflow_framework.2.5.0.dylib

Yes you are right thank you, the frustration here is that the distributed libtensorflow.2.5.0.dylib officially distributed on https://www.tensorflow.org/install/lang_c doesn't get the latest tensorflow-metal PluggableDevice enhancement. It's CPU only.

Is there any plan to distribute some kind of "libtensorflow-metal.2.5.0.dylib"? If not are you aware of some attempt to compile it locally, compiling tensorflow alone can already be a pain...

Cheers

Any update concerning a possible tensorflow-metal c_api ?

Tensorflow c_api link issue
 
 
Q