fix: resolve build failures on Ubuntu 22.04 with standard toolchain - #9
Open
sohamukute wants to merge 4 commits into
Open
sohamukute wants to merge 4 commits into
sohamukute wants to merge 4 commits into
Conversation
added 4 commits
February 27, 2026 21:28
edition = '2023' requires --experimental_editions and breaks standard protoc. proto3 is functionally equivalent for all types used here.
<format> was never used in the codebase and requires GCC 13+, breaking builds on Ubuntu 22.04 LTS which ships GCC 11.
proto3 does not generate has_*() for scalar string fields. Replace with field.empty() check which is the correct proto3 idiom.
Module mode picks up outdated system cmake FindProtobuf.cmake. CONFIG mode uses protobuf own cmake config files ensuring correct targets and protobuf_generate() behavior.
This branch has not been deployed
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
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.
I was trying to build NSB on a fresh Ubuntu 22.04 install and hit a few issues that blocked the build from completing.
1. proto/nsb.proto - switched from edition 2023 to proto3
The proto file was using
edition = "2023"which requires--experimental_editionsand isn't supported by standard protoc. Converted tosyntax = "proto3", all the message types are fully compatible so there's no functional change.2. cpp/include/nsb.h - removed unused
<format>include<format>was included but never used anywhere in the codebase. It also requires GCC 13+ which isn't the default on Ubuntu 22.04 (ships GCC 11), so it was breaking the build for no reason.3. cpp/src/nsb_daemon.cc - fixed string field checks for proto3
has_src_id()andhas_dest_id()don't get generated for scalar string fields in proto3. Replaced with.empty()checks which behave identically.4. CMakeLists.txt - CONFIG mode for find_package(Protobuf)
Module mode was picking up the outdated system cmake FindProtobuf.cmake instead of protobuf's own config files. Switching to CONFIG mode fixes this.
Tested on Ubuntu 22.04 / GCC 11.4.0, libnsb.so, nsb_daemon, and nsb_test all build successfully.