Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building "Getting Started" example: rebuild TensorFlow with the appropriate compiler flags #79

Open
natemurthy opened this issue Jan 22, 2023 · 5 comments

Comments

@natemurthy
Copy link

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?

@natemurthy
Copy link
Author

Seems to be related: #47 (comment)

@galeone
Copy link
Owner

galeone commented Jan 22, 2023

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

@natemurthy
Copy link
Author

Hm, definitely not an M2 on this old clunky Mac 🙃

@galeone
Copy link
Owner

galeone commented Jan 24, 2023

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)

@natemurthy
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants