tfgo
tfgo copied to clipboard
Error building "Getting Started" example: rebuild TensorFlow with the appropriate compiler flags
I'm trying to run the example from the "Getting Started" guide (https://github.com/galeone/tfgo#getting-started) on my MacBook, but after installing the prebuilt TensorFlow C library and tfgo
, updating my links, and attempting to build and run the example I encounter this error:
2023-01-21 19:01:59.670541: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
Referenced from: /usr/local/lib/libtensorflow.2.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ____chkstk_darwin
Referenced from: /usr/local/lib/libtensorflow.2.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
SIGABRT: abort
PC=0x108aef24a m=0 sigcode=0
signal arrived during cgo execution
...
exit status 2
The full output from the compiler is here: https://gist.github.com/natemurthy/b753830ed54ab47597f44d4b22127174
I'm guessing I'll have to build the TensorFlow C library from scratch. Is that what this implies, are could there be another solution that doesn't involve having to do this?
Seems to be related: https://github.com/galeone/tfgo/issues/47#issuecomment-808698606
Hi, it looks like you're running on an M2 mac (thus ARM architecture), but the library is built for x86_64 (there's no pre-built library for arm64 https://www.tensorflow.org/install/lang_c).
I have no experience with mac, but for sure you need to use things binary compatible. Hence, or you find a way to re-compile TensorFlow for ARM64 (but I guess it's not possible, otherwise google would have already provided the pre-built library), or you use Go built for x86_64.
I suggest you to open an issue on the TensorFlow repository since it's not something purely tfgo related, but everything depends on the TensorFlow C library
can you try to build a simple C program that uses the TensorFlow C library? In this way we can understand if it's related to Go or if it's related to the library provided and your OS (btw I still think this is TensorFlow specific issue, not tfgo)
Yes, I successfully built this C program: https://github.com/natemurthy/go-playground/blob/main/tfgo/hello_tf.c
nate:tfgo$ gcc hello_tf.c -ltensorflow -o hello_tf
nate:tfgo$ ./hello_tf
Hello from TensorFlow C library version 2.11.0