-
Notifications
You must be signed in to change notification settings - Fork 76
[fix][ProtobufNativeSchema] Fix build by converting abseil string_view to std::string #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <dann.frazier@chainguard.dev>
merlimat
reviewed
Dec 7, 2025
Contributor
Author
|
I can't reproduce the CI failure locally. Is this a test that sometimes needs to be retried? |
merlimat
approved these changes
Dec 7, 2025
Contributor
|
It's a flaky test, let me rerun |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #478
Motivation
Our
libpulsarbuilds started failing with latest upstream dependencies (abseil-cpp/protobuf). After creating this patch, I noticed @cho-m had already reported an issue and suggested a couple fixes, which are likely better than this. But that was months ago, so I figured I'd open a PR to push the conversation forward.Modifications
Explicitly convert absl string_view to std::string for use in the schemaJson.
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Documentation
doc-required(Your PR needs to update docs and you will update later)
doc-not-neededNo user-visible changes.
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)