Using NvCaffeParser at the same time as Protobuf causes an incomprehensible error

Hello.

I try to use NvCaffeParser and Protobuf in a project, but it fails at runtime with a cryptic message:

../../../externals/protobuf/aarch64/10.0/include/google/protobuf/generated_message_util.h:84:
const string& google::protobuf::internal::GetEmptyStringAlreadyInited():
Assertion `empty_string_ != __null' failed.

I made a minimal reproducible example. The main file is just:

#include <iostream>

#include "NvCaffeParser.h"

// Not even needed to make it bug
// #include "bug.pb.h"

int main() {
    nvcaffeparser1::ICaffeParser* parser = nvcaffeparser1::createCaffeParser();
    std::cout << "OK" << std::endl;
    return 0;
};

The CMakeLists looks like this:

cmake_minimum_required(VERSION 3.5)

set(CMAKE_CXX_FLAGS "-std=c++11")

find_package(Protobuf REQUIRED)

# Commenting the following line removes the bug
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS bug.proto)

include_directories(${CMAKE_BINARY_DIR})

add_executable(protobug main.cc ${PROTO_SRCS})
target_link_libraries(protobug ${PROTOBUF_LIBRARIES} nvcaffe_parser)

I shared all the files in a public repository, so testing it is a simple as this:

git clone https://AdrienBilberry@bitbucket.org/AdrienBilberry/nvcaffeparser-protobuf-bug.git && \
cd nvcaffeparser-protobuf-bug && \
./test_bug.sh

It is tested on a freshly flashed Jetson TX1 with JetPack 3.0 (bug appears in 2.3 too). Once flashed, I simply built and installed Protobuf from source (see install_protobuf.sh in the repo). I had to use the v3.0.0 otherwise I would get an error stating that aarch64/ditcaffe.pb.cc compiled version (3.0.0) was incompatible with installed version (3.2.0).

I am stuck on this since several weeks now. Any help would be much appreciated. Do you think it is an inner bug of NvCaffe? I guess it uses Protobuf internally, could this causes conflicts?

Hi,

Thanks for your problem.

This is a known issue and already been fixed in the tensorRT2.
TensorRT2 is available now via early access: https://developer.nvidia.com/tensorrt

We are sorry about this issue and please let us know the results.

Thanks.

This is great news, I am glad to hear that this is a known bug. Thank you for your reply, I applied for the early access.

After being accepted for early access, I unfortunately found that TensorRT 2 was only available for x86 platforms, while I was planning to use it on a Jetson TX1.

Would you have any solution or an indication about the availability date of the ARM version, please?

Hi ADGB,

The TensorRT2 for TX1 support is under planning, however there is no firm schedule yet. Once any clear information, I will share with you

Thanks