I'm working with google protocol buffers with Node.JS on Ubuntu 14.04 LTS. I have two different (A and B) Node.JS addons (c++) using the same protocol buffers and protobuf library. When I create a new instance of module B with require() after module A had been required before, the server stops with error message:
[libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: Anam.proto
[libprotobuf FATAL google/protobuf/descriptor.cc:1157] 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've googled the error and found that others experience this error only on Linux. I've also installed the latest version of protobuf library from github, but it didn't helped. The part of binding.gyp, where I include libprotobuf looks like this:
If I make more instances of the same module (for example require addon A 2 times), it works. Does anybody have any suggestion how to fix this problem?