Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 682212

Summary: sci-libs/tensorflow-1.13.0_rc2 with media-libs/opencv-3.4.1-r5 - python module conflicts over "tensorflow.AttrValue" protobuf symbol
Product: Gentoo Linux Reporter: Michael Moon <triffid.hunter>
Component: Current packagesAssignee: Amy Liffey <amynka>
Status: RESOLVED FIXED    
Severity: normal CC: amynka, perfinion
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Rename tensorflow namespace patch

Description Michael Moon 2019-04-01 08:53:23 UTC
$ python
Python 3.5.5 (default, Apr 24 2018, 21:05:32) 
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> import cv2
[libprotobuf ERROR /var/tmp/portage/dev-libs/protobuf-3.6.1.3/work/protobuf-3.6.1.3/src/google/protobuf/descriptor_database.cc:111] Symbol name "tensorflow.AttrValue" conflicts with the existing symbol "tensorflow.AttrValue".
[libprotobuf FATAL /var/tmp/portage/dev-libs/protobuf-3.6.1.3/work/protobuf-3.6.1.3/src/google/protobuf/descriptor.cc:1358] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
terminate called after throwing an instance of 'google::protobuf::FatalException'
what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
Aborted

(same results in python2.7 and python3.6)

While I could find very little info on google that seemed pertinent, https://stackoverflow.com/questions/51795326/static-linking-of-protocol-buffers-results-in-conflicts-with-existing-symbols?rq=1 may be relevant, and https://github.com/tensorflow/tensorflow/issues/9525 might be tangentially related.
Comment 1 Amy Liffey gentoo-dev 2019-04-01 17:32:42 UTC
This https://github.com/tensorflow/tensorflow/pull/19966 seems relevant.
Comment 2 Peter Serbe 2019-05-13 11:35:26 UTC
same here. No changes for tensorflow-1.13.1. I've tested protobuf-3.7.1 and 3.6.1.3: no difference between them. That patch, mentioned by Amy Liffey is present (at least in ./tensorflow/BUILD) - but something's going on behind the scenes. :-(

HOME\peter@hydra ~/PreyBlocker/Main/TrainAndTest_01 $ ./test.py
[libprotobuf ERROR /var/tmp/portage/dev-libs/protobuf-3.7.1/work/protobuf-3.7.1/src/google/protobuf/descriptor_database.cc:111] Symbol name "tensorflow.TensorShapeProto" conflicts with the existing symbol "tensorflow.TensorShapeProto".
[libprotobuf FATAL /var/tmp/portage/dev-libs/protobuf-3.7.1/work/protobuf-3.7.1/src/google/protobuf/descriptor.cc:1370] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
Aborted
Comment 3 Jason Zaman gentoo-dev 2019-09-25 11:30:45 UTC
Created attachment 591018 [details, diff]
Rename tensorflow namespace patch

I found the fix finally: 
https://github.com/opencv/opencv/pull/10092
https://github.com/opencv/opencv/commit/cb5da8983f911002ba8a316695c634111a62d274
Applying that commit to opencv fixes it for me. The fix is in opencv-3.4.4, so best is just to bump the package, there are several new versions that are not yet in the tree.

The patch does not apply as-is, ive attached the fixed patched which works when put in epatch_user
Comment 4 Michael Moon 2019-10-04 11:10:46 UTC
Works for me, thanks!
Comment 5 kfm 2020-08-12 11:37:03 UTC
All versions of opencv lower than 3.4.4 have been removed. Presumably, this bug can be marked as resolved.
Comment 6 kfm 2020-09-03 11:08:01 UTC
I am taking the liberty of closing this, per the prior comment and because tensorflow-1.x is no longer available in the gentoo repo. Hope that's OK.