zkmkarlsruhe / ofxTensorFlow2

TensorFlow 2 AI/ML library wrapper for openFrameworks
Other
109 stars 16 forks source link

"Undefined symbols for architecture arm64: "_TF_NewSessionOptions", referenced from:" on macOS ? #15

Closed stephanschulz closed 2 years ago

stephanschulz commented 2 years ago

Hi. Thanks for make this addon available to us.

I am on macOS 10.15.7, OF 0.11.2m Xcode 12.4

I followed the macOS install steps and get a bunch of compile errors related to arm64

Would you know why? Should I rather try OF 0.11.0 ? Should I be on a more recent macOS?

Undefined symbols for architecture arm64:
  "_TF_NewSessionOptions", referenced from:
      cppflow::model::model(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ofxTF2Model.o
  "_TF_NewBufferFromString", referenced from:
      cppflow::model::model(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ofxTF2Model.o
  "_TF_NewGraph", referenced from:
      cppflow::model::model(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ofxTF2Model.o
  "_TF_DeleteSessionOptions", referenced from:
      cppflow::model::model(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ofxTF2Model.o
  "_TF_GraphNextOperation", referenced from:
      cppflow::model::get_operations() const in ofxTF2Model.o
  "_TF_GraphGetTensorNumDims", referenced from:
      cppflow::model::get_operation_shape(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in ofxTF2Model.o
  "_TF_OperationName", referenced from:
      cppflow::model::get_operations() const in ofxTF2Model.o
  "_TF_GraphOperationByName", referenced from:
      cppflow::model::operator()(std::__1::vector<std::__1::tuple<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, cppflow::tensor>, std::__1::allocator<std::__1::tuple<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, cppflow::tensor> > >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >) in ofxTF2Model.o
      cppflow::model::get_operation_shape(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in ofxTF2Model.o
  "_TF_SessionRun", referenced from:
Screen Shot 2022-01-17 at 2 10 11 PM Screen Shot 2022-01-17 at 2 09 50 PM Screen Shot 2022-01-17 at 2 09 27 PM
stephanschulz commented 2 years ago

I changing VER=2.6.0 to VER=2.7.0 in this line: https://github.com/zkmkarlsruhe/ofxTensorFlow2/blob/main/scripts/download_tensorflow.sh#L12

seems to solve this.

danomatika commented 2 years ago

libtensorflow builds for mac are currently x86_64 only. Most likely, you need to add arm64 to the Xcode projects' excluded architectures and rebuild.

stephanschulz commented 2 years ago

I am on a MacBook Pro 2.3 GHz 8-Core Intel Core i9. Simply switching to VER=2.7.0 did the trick.

For reference what my project build target shows for Architecture

Screen Shot 2022-01-17 at 2 44 36 PM Screen Shot 2022-01-17 at 2 44 20 PM Screen Shot 2022-01-17 at 2 46 38 PM

Thanks again for making TensorFlow accessible to OF

stephanschulz commented 2 years ago

Actually I am now noticing that it builds fine in Debug mode but gives the first reported errors for Release mode.

stephanschulz commented 2 years ago

and you are correct that adding arm64to the excluded architectures solved the issue also for Release mode.

Screen Shot 2022-01-17 at 2 56 18 PM
danomatika commented 2 years ago

We are considering providing builds for macOS arm64 and I know there are some unofficial builds on GitHub, but they are out of date. I'm still a bit surprised there aren't official universal builds yet, but I guess none on the TF team uses macOS.