From f8e809660e3a009bdbf943fa9b23d269b55e415b Mon Sep 17 00:00:00 2001 From: dann frazier Date: Sun, 7 Dec 2025 08:43:17 -0700 Subject: [PATCH] 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&'} from expression of type 'absl::lts_20250814::string_view' {aka 'std::basic_string_view'} 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&'} from expression of type 'absl::lts_20250814::string_view' {aka 'std::basic_string_view'} 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 --- lib/ProtobufNativeSchema.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ProtobufNativeSchema.cc b/lib/ProtobufNativeSchema.cc index 632943da..c3a4ed8f 100644 --- a/lib/ProtobufNativeSchema.cc +++ b/lib/ProtobufNativeSchema.cc @@ -39,8 +39,8 @@ SchemaInfo createProtobufNativeSchema(const google::protobuf::Descriptor* descri } const auto fileDescriptor = descriptor->file(); - const std::string& rootMessageTypeName = descriptor->full_name(); - const std::string& rootFileDescriptorName = fileDescriptor->name(); + const std::string& rootMessageTypeName = std::string(descriptor->full_name()); + const std::string& rootFileDescriptorName = std::string(fileDescriptor->name()); FileDescriptorSet fileDescriptorSet; internalCollectFileDescriptors(fileDescriptor, fileDescriptorSet);