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

protobuf link error with floopcz/tensorflow_cc:ubuntu-2.2.0 #219

Closed
jimlloyd opened this issue May 10, 2020 · 6 comments · Fixed by #246
Closed

protobuf link error with floopcz/tensorflow_cc:ubuntu-2.2.0 #219

jimlloyd opened this issue May 10, 2020 · 6 comments · Fixed by #246

Comments

@jimlloyd
Copy link

I'm trying to upgrade my project to tensorflow 2.2. My project uses tensorflow::LoadSavedModel provided by tensorflow/cc/saved_model/loader.h. With 2.2 I get this link error:

/usr/bin/ld: lib/libcore_lib.a(Predictor.cpp.o): in function `tensorflow::SavedModelBundle::GetSignatures[abi:cxx11]() const':
Predictor.cpp:(.text._ZNK10tensorflow16SavedModelBundle13GetSignaturesB5cxx11Ev[_ZNK10tensorflow16SavedModelBundle13GetSignaturesB5cxx11Ev]+0x10): undefined reference to `google::protobuf::internal::MapFieldBase::SyncMapWithRepeatedField() const'

Previously I was able to build protobuf v3.8.0 and install it as a system library. I initially tried that and ran into this error. It seems that tensorflow 2.2rc4 is still using v3.8.0, although with a patch.

https://github.com/tensorflow/tensorflow/blob/r2.2/tensorflow/workspace.bzl

# 310ba5ee72661c081129eb878c1bbcec936b20f0 is based on 3.8.0 with a fix for protobuf.bzl.

So I tried installing protobuf using the same tarball, but I see the same link error.

Have you been able to use LoadSavedModel with tensorflow 2.2? Do you have any suggestions for how I could resolve this problem?

@jappoz
Copy link

jappoz commented Jun 11, 2020

I am having the same issue.
Interestingly enough, the error disappears if I use SavedModelBundleLite instead of SavedModelBundle in LoadSavedModel function.

Did someone find a solution for this?

@jappoz
Copy link

jappoz commented Jun 12, 2020

I found a solution here.
The problem seems to be tensorflow not exporting protobuf symbols.

@jimlloyd
Copy link
Author

I have confirmed that using SavedModelBundleLite fixes the link error in my app. That interface is now documented as the preferred interface in new code:

// A version of SavedModelBundle that avoids storing a potentially large
// MetaGraphDef. Prefer to use SavedModelBundleLite in new code.

I think that means it is acceptable to close this issue.

Thanks @jappoz!

@michaelnguyen11
Copy link

I think the problem is that author removed "protobuf" in cmake. See this commit : c1520a0

Reverted this commit and I could use the LoadSavedBundle function normally.

@xiandong79
Copy link

@FloopCZ do you think See this commit : c1520a0 should be reverted or not?

@FloopCZ
Copy link
Owner

FloopCZ commented Nov 17, 2020

Hi @xiandong79, feel free to try #246 .

@FloopCZ FloopCZ linked a pull request Jun 13, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

5 participants