https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=700307#10
> FYI, in upstream, currently we don't consider this as a bug to be fixed
> because we have no reason to use protobuf as a dynamic link library. Mozc
> binaries for all the platforms (Windows, Mac, Chromium OS, Android) have
> been released with linking to protobuf statically.
>
> I hope you find a good work around.

It is not fixed in the upstream.
Can not the setting of mozc in this state.

> $ /usr/lib/mozc/mozc_tool --mode=config_dialog
> Gtk-Message: Failed to load module "canberra-gtk-module"
> [libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already 
> exists in database: session/candidates.proto
> [libprotobuf FATAL google/protobuf/descriptor.cc:1018] CHECK failed: 
> generated_database_->Add(encoded_file_descriptor, size):
> terminate called after throwing an instance of 
> 'google::protobuf::FatalException'
>   what():  CHECK failed: generated_database_->Add(encoded_file_descriptor, 
> size):

I want to patch the protobuf.
Index: src/google/protobuf/message.cc
===================================================================
--- src/google/protobuf/message.cc      (revision 490)
+++ src/google/protobuf/message.cc      (working copy)
@@ -277,7 +277,8 @@
 void GeneratedMessageFactory::RegisterFile(
     const char* file, RegistrationFunc* registration_func) {
   if (!InsertIfNotPresent(&file_map_, file, registration_func)) {
-    GOOGLE_LOG(FATAL) << "File is already registered: " << file;
+       registration_func(file);
+    //GOOGLE_LOG(FATAL) << "File is already registered: " << file;
   }
 }
 
@@ -292,7 +293,7 @@
   // the mutex.
   mutex_.AssertHeld();
   if (!InsertIfNotPresent(&type_map_, descriptor, prototype)) {
-    GOOGLE_LOG(DFATAL) << "Type is already registered: " << 
descriptor->full_name();
+    //GOOGLE_LOG(DFATAL) << "Type is already registered: " << 
descriptor->full_name();
   }
 }
 
Index: src/google/protobuf/descriptor_database.cc
===================================================================
--- src/google/protobuf/descriptor_database.cc  (revision 490)
+++ src/google/protobuf/descriptor_database.cc  (working copy)
@@ -309,7 +309,18 @@
     const void* encoded_file_descriptor, int size) {
   FileDescriptorProto file;
   if (file.ParseFromArray(encoded_file_descriptor, size)) {
+    std::pair<const void*, int> existing = index_.FindFile(file.name());
+    if (existing.first) {
+      if (existing.second == size && memcmp(existing.first, 
encoded_file_descriptor, size) == 0) {
+        // Contents match
+        return true;
+      }
+      else {
+        GOOGLE_LOG(ERROR) << "File descriptor " << file.name() << " is already 
registered, but descriptor contents are different";
+      }
+    }
     return index_.AddFile(file, make_pair(encoded_file_descriptor, size));
+
   } else {
     GOOGLE_LOG(ERROR) << "Invalid file descriptor data passed to "
                   "EncodedDescriptorDatabase::Add().";

Reply via email to