Skip to content

(Linux) Fails to compile on latest version of protobuf #370

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

Open
m2neral opened this issue Apr 2, 2025 · 0 comments · May be fixed by #371
Open

(Linux) Fails to compile on latest version of protobuf #370

m2neral opened this issue Apr 2, 2025 · 0 comments · May be fixed by #371

Comments

@m2neral
Copy link

m2neral commented Apr 2, 2025

GameNetworkingSockets fails to compile after updating arch linux. In src/steamnetworkingsockets/clientlib/csteamnetworkingsockets.cpp SteamNetworkingIdentityToProtobuf gives No member named 'c_str' in 'std::basic_string_view<char>. Did something change with protobuf? It was compiling without issues just a few weeks ago.

ManManson added a commit to ManManson/GameNetworkingSockets that referenced this issue Apr 6, 2025
Starting from Protobuf 29.0, `protobuf::Message::GetTypeName()` can
return either `std::string` or `absl::string_view`, depending on
Abseil build options.

For more details, see:

	protocolbuffers/protobuf@e13b8e9

Adapt the code accordingly by changing from `.c_str()` to `.data()`,
as the `.data()` method is available in both `std::string` and
`absl::string_view`.

Fixes: ValveSoftware#370

Signed-off-by: Pavel Solodovnikov <[email protected]>
ManManson added a commit to ManManson/GameNetworkingSockets that referenced this issue Apr 6, 2025
Starting from Protobuf 29.0, `protobuf::Message::GetTypeName()` can
return either `std::string` or `absl::string_view`, depending on
Abseil build options.

For more details, see:

	protocolbuffers/protobuf@e13b8e9

Adapt the code accordingly by changing from `.c_str()` to `.data()`,
as the `.data()` method is available in both `std::string` and
`absl::string_view`.

Fixes: ValveSoftware#370

Signed-off-by: Pavel Solodovnikov <[email protected]>
Octol1ttle pushed a commit to Octol1ttle/GameNetworkingSockets that referenced this issue Apr 9, 2025
Starting from Protobuf 29.0, `protobuf::Message::GetTypeName()` can
return either `std::string` or `absl::string_view`, depending on
Abseil build options.

For more details, see:

	protocolbuffers/protobuf@e13b8e9

Adapt the code accordingly by changing from `.c_str()` to `.data()`,
as the `.data()` method is available in both `std::string` and
`absl::string_view`.

Fixes: ValveSoftware#370

Signed-off-by: Pavel Solodovnikov <[email protected]>
ManManson added a commit to ManManson/GameNetworkingSockets that referenced this issue Apr 11, 2025
Starting from Protobuf 29.0, `protobuf::Message::GetTypeName()` can
return either `std::string` or `absl::string_view`, depending on
Abseil build options.

For more details, see:

	protocolbuffers/protobuf@e13b8e9

Detect the return type of the method in compile-time and construct a
supplementary `std::string`, from which we can obtain a proper
null-terminated buffer and pass it to the internal assertion function,
if needed.

Fixes: ValveSoftware#370

Signed-off-by: Pavel Solodovnikov <[email protected]>
ManManson added a commit to ManManson/GameNetworkingSockets that referenced this issue Apr 15, 2025
Starting from Protobuf 29.0, `protobuf::Message::GetTypeName()` can
return either `std::string` or `absl::string_view`, depending on
Abseil build options.

For more details, see:

	protocolbuffers/protobuf@e13b8e9

Construct a temporary `std::string` to obtain a proper null-terminated
buffer to use in `AssertMsg*`.
Note that the lifetime of this instance will end just after the
`AssertMsg2()` function call returns, hence this usage is safe (see
https://eel.is/c++draft/class.temporary#4 for more details).

Fixes: ValveSoftware#370

Signed-off-by: Pavel Solodovnikov <[email protected]>
ManManson added a commit to Warzone2100/GameNetworkingSockets that referenced this issue Apr 27, 2025
Starting from Protobuf 29.0, `protobuf::Message::GetTypeName()` can
return either `std::string` or `absl::string_view`, depending on
Abseil build options.

For more details, see:

	protocolbuffers/protobuf@e13b8e9

Construct a temporary `std::string` to obtain a proper null-terminated
buffer to use in `AssertMsg*`.
Note that the lifetime of this instance will end just after the
`AssertMsg2()` function call returns, hence this usage is safe (see
https://eel.is/c++draft/class.temporary#4 for more details).

Fixes: ValveSoftware#370

Signed-off-by: Pavel Solodovnikov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant