Skip to content

Commit f8e8096

Browse files
committed
ProtobufNativeSchema: convert abseil string_view to std::string
This resolves the following build failure using abseil-cpp 20250814.1: ``` [ 1%] Building CXX object lib/CMakeFiles/PULSAR_OBJECT_LIB.dir/ProtobufNativeSchema.cc.o cd /home/build/pulsar-client-cpp/build/lib && /usr/local/bin/c++ -DBOOST_ALLOW_DEPRECATED_HEADERS -DBOOST_ALL_NO_LIB -DBUILDING_PULSAR -DHAS_SNAPPY=0 -DHAS_ZSTD=0 -DPULSAR_AUXV_GETAUXVAL_PRESENT -I/home/build/pulsar-client-cpp -I/home/build/pulsar-client-cpp/include -I/home/build/pulsar-client-cpp/build/include -I/home/build/pulsar-client-cpp/build/generated -I/home/build/pulsar-client-cpp/build/generated/lib -Wno-array-bounds -O2 -g -DNDEBUG -std=gnu++17 -fPIC -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -msse4.2 -mpclmul -fdiagnostics-show-option -fdiagnostics-color -fvisibility=hidden -MD -MT lib/CMakeFiles/PULSAR_OBJECT_LIB.dir/ProtobufNativeSchema.cc.o -MF CMakeFiles/PULSAR_OBJECT_LIB.dir/ProtobufNativeSchema.cc.o.d -o CMakeFiles/PULSAR_OBJECT_LIB.dir/ProtobufNativeSchema.cc.o -c /home/build/pulsar-client-cpp/lib/ProtobufNativeSchema.cc /home/build/pulsar-client-cpp/lib/ProtobufNativeSchema.cc: In function 'pulsar::SchemaInfo pulsar::createProtobufNativeSchema(const google::protobuf::Descriptor*)': /home/build/pulsar-client-cpp/lib/ProtobufNativeSchema.cc:42:67: error: invalid initialization of reference of type 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} from expression of type 'absl::lts_20250814::string_view' {aka 'std::basic_string_view<char>'} 42 | const std::string& rootMessageTypeName = descriptor->full_name(); | ~~~~~~~~~~~~~~~~~~~~~^~ /home/build/pulsar-client-cpp/lib/ProtobufNativeSchema.cc:43:69: error: invalid initialization of reference of type 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} from expression of type 'absl::lts_20250814::string_view' {aka 'std::basic_string_view<char>'} 43 | const std::string& rootFileDescriptorName = fileDescriptor->name(); | ~~~~~~~~~~~~~~~~~~~~^~ make[2]: *** [lib/CMakeFiles/PULSAR_OBJECT_LIB.dir/build.make:1052: lib/CMakeFiles/PULSAR_OBJECT_LIB.dir/ProtobufNativeSchema.cc.o] Error 1 ``` Signed-off-by: dann frazier <[email protected]>
1 parent c64e0e9 commit f8e8096

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ProtobufNativeSchema.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ SchemaInfo createProtobufNativeSchema(const google::protobuf::Descriptor* descri
3939
}
4040

4141
const auto fileDescriptor = descriptor->file();
42-
const std::string& rootMessageTypeName = descriptor->full_name();
43-
const std::string& rootFileDescriptorName = fileDescriptor->name();
42+
const std::string& rootMessageTypeName = std::string(descriptor->full_name());
43+
const std::string& rootFileDescriptorName = std::string(fileDescriptor->name());
4444

4545
FileDescriptorSet fileDescriptorSet;
4646
internalCollectFileDescriptors(fileDescriptor, fileDescriptorSet);

0 commit comments

Comments
 (0)