QUESTIONS about Protobuf integration with Deepstream

• Hardware Platform (GPU)
• DeepStream Version: 7.0 (From NGC Container)
• NVIDIA GPU Driver Version (valid for GPU only): 550
• Issue Type( questions, MAYBE BUG?)

Context:
I want to implement my own protobuf-process logic in a probe function, i use protobuf library in 2 locations, here are some contexts :

  1. From my customized Inferserver plugin to save some meta data into protobuf format and attach them into user_meta_list
  2. In later part, I use probe function to extract them and do some postprocess
  3. the .proto file is created by myself and statically link to the custom inferserver .so and my executable
  4. I upgrade the cmake version from 3.19 to 3.28 when building the image
  5. I can see protobuf libs in /root/.local/lib and /opt/tritonclient/
  6. i changed the following ENV in order to use the protobuf lib inside this container:
ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/root/.local/lib:/opt/nvidia/deepstream/deepstream/lib
ENV PATH="/root/.local/bin:${PATH}"

Now, my program crash when creating nvurisrcbin, saying:
[libprotobuf FATAL /tmp/grpc/third_party/protobuf/src/google/protobuf/stubs/common.cc:83] This program was compiled against version 3.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.19.4). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/timestamp.pb.cc".)

This is quite confusing that i have no idea which libs use the 3.6.1 protobuf as library…

The call-stack that cause exception shows this, is there any way i can deal with this?

Since both nvmsgconv and trition use protobuf, in order to ensure that the same version is used.

Please use /opt/tritonclient/lib/libprotobuf.a and /opt/proto/bin/protoc, they are the same version,You can use them in your own applications

  1. My program is not using nvmsgconv module yet, unless i linked it unintentionally;
  2. I checked the protobuf in this container, it’s in /opt/tritonclient/ and /root/.local, both of which is 3.19.4(defined in google/protobuf/stub/common.h), so the triton client use the 3.19 version, including protoc, they are both 3.19 version
  3. I used to suspect this was caused by the upgrade of cmake, but the container itself contains the 3.19 protobuf by default
  4. From the call-stack info, this error happends when build the nvurisrcbin, i think some of the features (maybe SR or RESTFUL related?) use the old version of protobuf
  5. I saw this problem was reported in this link before, but seems not helpful to me…
    link

I finally work this out.

FYI:

  1. There are 2 protobuf in container, /root/.local/lib and /opt/tritonclient/lib, they are both 3.19.4

  2. The msgconv module, as is shown in the source code, specifies the protobuf finding path in the tritonclient’s directory like this:

LIBS+= -L/opt/tritonclient/lib -lyaml-cpp -lprotobuf \
  -L/usr/local/cuda/lib64 -lcudart
  1. the author of this container seems set the wrong environment variables, so anyone won’t be able to search the one in /root/.local/lib, unless set:
PKG_CONFIG_PATH="/root/.local/lib/pkgconfig"

(may also need to FIX the one in PATH=xxxx:/.local/bin)

The solution for me:

  • use the “target” based paradigm to “import” protobuf in /root/... to generate source code with protoc according to my .proto files
  • use add_library in CMake to create a protobuf library referring to the one that is inside tritonclient

The CMake code roughly looks like:

find_package(Protobuf REQUIRED)

add_library(triton_protobuf STATIC IMPORTED)
add_library(triton::protobuf ALIAS triton_protobuf)
set_target_properties(
  triton_protobuf
  PROPERTIES IMPORTED_LOCATION "/opt/tritonclient/lib/libprotobuf.a"
             INTERFACE_INCLUDE_DIRECTORIES "/root/.local/include" # /opt/tritonclient/include also works
)

...
target_link_libraries(
  ${PROJECT_NAME} PUBLIC triton::protobuf # WORK
                         # protobuf::libprotobuf NOT WORK!!
)

In this code, i can use header and static library in 2 different locations, because they are the same version.

BUT I still don’t know which library use the old 3.6.1 version protobuf. Any idea??

Thanks for sharing.

I have some suggestions,You’d better use the trition version for include/protoc/lib to avoid the issues that other deepstream elements refer to different versions of the library. Do not use /root/.local/include to avoid problems caused by version changes

This means:

include : /opt/tritonclient/include/google/protobuf
protoc: /opt/proto/bin/protoc
lib: /opt/tritonclient/lib/libprotobuf.a

echo $PATH, Do these paths contain other versions of protoc? This problem is usually caused by protoc

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.