Skip to content
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

build: relax the version constraint for Protobuf #2132

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

tchaikov
Copy link
Contributor

@tchaikov tchaikov commented Mar 6, 2024

as higher versions of Protobuf does not claim to be compatible with
v2.5.0, so we should not specify a version number which is acceptable
by Seastar as a parameter of find_package(). and instead, we just
check the version number after calling find_package() in config mode.
if we find the package using config mode, we search it again, for
printing out the version number to the stdout, otherwise we search
using its C++ API version.

Refs ##2113

@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 6, 2024

@mickey298 could you help test this change?

@@ -159,11 +159,11 @@ macro (seastar_find_dependencies)
# ProtobufConfig.cmake provided by protobuf defines this linkage. so we try
# the CMake package configuration file first, and fall back to CMake's
# FindProtobuf module.
find_package (Protobuf 2.5.0
find_package (Protobuf 22.0...25.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how 2.5.0 worked before and now it's 22.0..22.3. I understood there are two versioning systems, but you don't change versioning systems here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does 26 not work?

Copy link
Contributor Author

@tchaikov tchaikov Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avikivity

I don't understand how 2.5.0 worked before and now it's 22.0..22.3. I understood there are two versioning systems, but you don't change versioning systems here.

22.0 is the first version which uses abseil. so i wanted to make this explicit. and i didn't want to mix two versioning systems in a single condition, like find_package (Protobuf 2.5...25.3) even if it would yield the expected outcome. but it's just weird..

Also, does 26 not work?

yeah, i asked myself the same question when writing these numbers. but i wanted to avoid adding versions in future and wanted to avoid pretending that we support versions we haven't even compiled with. that's why it looks this way. but it didn't pan out.

anyway, i am pushing an updated version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I didn't understand is the version jump from 2 to 22. Was the numbering changed? Or do the version numbers refer to different things?

Copy link
Contributor Author

@tchaikov tchaikov Mar 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please note, in the latest revision i stopped using 22 as the version number, because it's not only confusing but also, more importantly, it didn't work due to upstream failed to mark compatibility with the CMake configuration file -- so, v23 is only compatible with v23, etc.. and sorry, i failed to explain my reasoning on the previous revision in an understandable way. let me rephrase it.

more like it refers to a different thing.

actually i didn't bumped the version from 2 to 22. it was because, the CMake configuration file shipped by Protobuf uses the library's version, i.e., 22 and 23..., while the FindProtobuf module uses the language binding's version, like 2.5, 3.12, 3.21, 4.22, .... . the cutting edge distros are more likely to use the CMake configuration file shipped by Protobuf, so i intended to use the library's version when finding the package using the config mode, and i need to pick a library version . instead of trying to map 2.5 to "protobuf v5.0" which does not exst at all. i guess the reason is that it predates the version when protobuf developers decided to using this new versioning approach. so, i used v22, which is the first version which uses abseil, in hope that i could assure that the change works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks.

@mykaul
Copy link

mykaul commented Mar 6, 2024

Is it somehow aligned with the version Prometheus uses (CC @amnonh ) ?

and add it as a dependency for generating C++ bindings. simpler this
way. protobuf::protoc was added to FindProtobuf in CMake 3.10, and
our minimal required CMake version is 3.13, so we should be able to
have access to this variable as long as Protobuf is found.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
@tchaikov tchaikov force-pushed the cmake-protobuf branch 2 times, most recently from 9f20ba8 to efc814e Compare March 6, 2024 15:16
as higher versions of Protobuf does not claim to be compatible with
v2.5.0, so we should not specify a version number which is acceptable
by Seastar as a parameter of `find_package()`. and instead, we just
check the version number after calling `find_package()` in config mode.
if we find the package using config mode, we search it again, for
printing out the version number to the stdout, otherwise we search
using its C++ API version.

Refs #scylladb#2113

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 6, 2024

v2:

  • do not enforce version constraints when finding protobuf in config mode, as it turns out protobuf's cmake configuration does not claim the compatibility with other versions part from its exact version.
  • check the minimal required version of 2.5.0 instead of the minimal version which introduced abseil libraries linkage. simpler and more consistent this way.

@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 6, 2024

Is it somehow aligned with the version Prometheus uses (CC @amnonh ) ?

@mykaul hi Yaniv, this change is intended to address the FTBFS on a very bleeding edge distro which

  1. packages a very new protobuf
  2. packages protobuf's CMake configuration file.

the metrics' on-wire protocol is defined by https://buf.build/gogo/protobuf/file/4df00b267f944190a229ce3695781e99:gogoproto/gogo.proto and https://github.com/prometheus/prometheus/blob/main/prompb/io/prometheus/client/metrics.proto. when it comes to the C++ language binding. i think protobuf compiler should be backward compatible in this regards.

@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 6, 2024

per @mickey298 's test at #2113 (comment) . the change does address the FTBFS.

@tchaikov
Copy link
Contributor Author

@scylladb/seastar-maint hello maintainers, could you review this change?

@avikivity avikivity closed this in 3c74aec Mar 13, 2024
@avikivity avikivity merged commit 3c74aec into scylladb:master Mar 13, 2024
14 checks passed
graphcareful pushed a commit to graphcareful/seastar that referenced this pull request Mar 20, 2024
as higher versions of Protobuf does not claim to be compatible with
v2.5.0, so we should not specify a version number which is acceptable
by Seastar as a parameter of `find_package()`. and instead, we just
check the version number after calling `find_package()` in config mode.
if we find the package using config mode, we search it again, for
printing out the version number to the stdout, otherwise we search
using its C++ API version.

Refs #scylladb#2113

Closes scylladb#2132

* github.com:scylladb/seastar:
  build: relax the version constraint for Protobuf
  build: use protobuf::protoc for the path to protoc compiler
@tchaikov tchaikov deleted the cmake-protobuf branch June 7, 2024 01:45
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 this pull request may close these issues.

None yet

3 participants