question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

C++ static linking of ONNX results in conflicts with existing symbols

See original GitHub issue

We are trying to implement an ONNX importer for a C++ runtime. Our runtime will be used by frontend applications, which also use ONNX models.

When trying to execute a process which runs both frontend and backend components, we are seeing errors indicating that a Protocol Buffers symbol name conflicts with the existing symbol.

[libprotobuf ERROR google/protobuf/descriptor_database.cc:109] Symbol name "onnx.AttributeProto" conflicts with the existing symbol "onnx.AttributeProto".
[libprotobuf FATAL google/protobuf/descriptor.cc:1164] 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):
Aborted (core dumped)

Did anyone already run into this problem? Have you found a good solution to this issue?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
apwojcikcommented, Aug 14, 2018

I would like to let you know that we eventually fixed the problem by statically linking the protobuf library into our shared object. No namespace change was required in ONNX and the client application is working fine with our library.

1reaction
yinghaicommented, Aug 11, 2018

This will likely have problems as protobuf has a global registry based on proto file name. If you have two .so file that contains onnx.pb.cc, this issue will happen. The trick we do is to define a different namespace for onnx when used in third-party and rely on onnx’s CMakefile to do the symbol replacement and renaming. Here is an example:

https://github.com/onnx/onnx-tensorrt/blob/fa0964e8477fc004ee2f49ee77ffce0bf7f711a9/CMakeLists.txt#L93-L97

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - Static linking of Protocol Buffers results in conflicts with ...
When trying to execute a process which runs both frontend and backend components, we are seeing errors indicating that a symbol name conflicts...
Read more >
Static linking of Protocol Buffers results in conflicts with ...
Coding example for the question Static linking of Protocol Buffers results in conflicts with existing symbols-C++.
Read more >
TensorRT 8.4.1 Release Notes - NVIDIA Documentation Center
When the TensorRT static library was used to build engines and ... to build TensorRT, it may lead to symbol conflicts or undesired...
Read more >
Package Details: mxnet-cuda 1.7.0-2 - AUR (en) - Arch Linux
The CUDA-10.2 pacakge in Arch Linux is statically linked to GCC-8. Mixing GCC-8 and GCC-9 compilation units may result in UB.
Read more >
vocab.txt · florentgbelidji/onnx-msmarco-distilbert-base-tas-b ...
... difference acts attacks ##ov existing votes opportunity nor shop entirely trains opposite pakistan ##pa develop resulted representatives actions reality ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found