doc-ai / tensorio-ios

Tensor/IO for iOS, with support for on-device inference and training with TensorFlow and TensorFlow Lite
Other
31 stars 10 forks source link

Fix libprotobuf error File already exists in database #192

Open phildow opened 4 years ago

phildow commented 4 years ago

For applications that use the TensorFlow backend it is not possible for the Test targets to have a host application. Which means that tests can target application code. Not good.

With default setting we see the following error when trying to build a Test target:

[libprotobuf ERROR google/protobuf/descriptor_database.cc:58] 
File already exists in database: tensorflow/contrib/boosted_trees/proto/learner.proto

[libprotobuf FATAL google/protobuf/descriptor.cc:1358]
CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):

The only solution is to set the Host Application to None for the test target

This leads to a second problem where symbols cannot be found during test target linking, which can only be solved by modifying the test target block in the Podfile to comment out:

# inherit! :search_paths

I believe this is a problem with coocapods linking the library twice, once into the host application and the second time into the test target.