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

GH-41333: [C++][CMake] Prefer protobuf-config.cmake to FindProtobuf.cmake #41360

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

kou
Copy link
Member

@kou kou commented Apr 24, 2024

Rationale for this change

protobuf::libprotobuf provided by FindProtobuf.cmake (provided by CMake) may not provide needed dependencies such as Abseil.

What changes are included in this PR?

Try protobuf-config.cmake provided by Protobuf before FindProtobuf.cmake.
protobuf::libprotobuf provided by protobuf-config.cmake must have needed dependencies.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

@kou
Copy link
Member Author

kou commented Apr 24, 2024

@github-actions crossbow submit -g cpp -g python -g r

Copy link

⚠️ GitHub issue #41333 has been automatically assigned in GitHub to PR creator.

This comment was marked as outdated.

@kou kou force-pushed the cpp-cmake-protobuf-config branch from 17ecdd1 to 53157c0 Compare April 24, 2024 00:49
@kou
Copy link
Member Author

kou commented Apr 24, 2024

@github-actions crossbow submit -g cpp -g python -g r

Copy link

Revision: 53157c0

Submitted crossbow builds: ursacomputing/crossbow @ actions-6323df8a9c

Task Status
example-python-minimal-build-fedora-conda GitHub Actions
example-python-minimal-build-ubuntu-venv GitHub Actions
r-binary-packages GitHub Actions
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-conda-python-3.10 GitHub Actions
test-conda-python-3.10-cython2 GitHub Actions
test-conda-python-3.10-hdfs-2.9.2 GitHub Actions
test-conda-python-3.10-hdfs-3.2.1 GitHub Actions
test-conda-python-3.10-pandas-latest GitHub Actions
test-conda-python-3.10-pandas-nightly GitHub Actions
test-conda-python-3.10-spark-v3.5.0 GitHub Actions
test-conda-python-3.10-substrait GitHub Actions
test-conda-python-3.11 GitHub Actions
test-conda-python-3.11-dask-latest GitHub Actions
test-conda-python-3.11-dask-upstream_devel GitHub Actions
test-conda-python-3.11-hypothesis GitHub Actions
test-conda-python-3.11-pandas-upstream_devel GitHub Actions
test-conda-python-3.11-spark-master GitHub Actions
test-conda-python-3.12 GitHub Actions
test-conda-python-3.8 GitHub Actions
test-conda-python-3.8-pandas-1.0 GitHub Actions
test-conda-python-3.8-spark-v3.5.0 GitHub Actions
test-conda-python-3.9 GitHub Actions
test-conda-python-3.9-pandas-latest GitHub Actions
test-cuda-cpp GitHub Actions
test-cuda-python GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-debian-12-python-3-amd64 GitHub Actions
test-debian-12-python-3-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-fedora-39-python-3 GitHub Actions
test-fedora-r-clang-sanitizer GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-bundled Azure
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-minimal-build Azure
test-r-offline-maximal GitHub Actions
test-r-offline-minimal Azure
test-r-rhub-debian-gcc-devel-lto-latest Azure
test-r-rhub-debian-gcc-release-custom-ccache Azure
test-r-rhub-ubuntu-gcc-release-latest Azure
test-r-rocker-r-ver-latest Azure
test-r-rstudio-r-base-4.1-opensuse153 Azure
test-r-rstudio-r-base-4.2-centos7-devtoolset-8 Azure
test-r-rstudio-r-base-4.2-focal Azure
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-ubuntu-20.04-cpp GitHub Actions
test-ubuntu-20.04-cpp-bundled GitHub Actions
test-ubuntu-20.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-20.04-cpp-thread-sanitizer GitHub Actions
test-ubuntu-20.04-python-3 GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-22.04-python-3 GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-r-sanitizer GitHub Actions

@raulcd
Copy link
Member

raulcd commented Apr 25, 2024

Thanks @kou I was trying something similar on Conda:

diff --git a/cpp/cmake_modules/FindProtobufAlt.cmake b/cpp/cmake_modules/FindProtobufAlt.cmake
index 15fe1b4..71a4a1c 100644
--- a/cpp/cmake_modules/FindProtobufAlt.cmake
+++ b/cpp/cmake_modules/FindProtobufAlt.cmake
@@ -28,9 +28,19 @@ endif()
 if(ProtobufAlt_FIND_QUIETLY)
   list(APPEND find_package_args QUIET)
 endif()
-find_package(Protobuf ${find_package_args})
-set(ProtobufAlt_FOUND ${Protobuf_FOUND})
-if(ProtobufAlt_FOUND)
+find_package(protobuf CONFIG ${find_package_args})
+set(ProtobufAlt_FOUND ${protobuf_FOUND})
+if(NOT ProtobufAlt_FOUND)
+  find_package(Protobuf ${find_package_args})
+  set(ProtobufAlt_FOUND ${Protobuf_FOUND})
+endif()
+if(protobuf_FOUND)
+  set(ProtobufAlt_VERSION ${protobuf_VERSION})
+  set(ProtobufAlt_VERSION_MAJOR ${protobuf_VERSION_MAJOR})
+  set(ProtobufAlt_VERSION_MINOR ${protobuf_VERSION_MINOR})
+  set(ProtobufAlt_VERSION_PATCH ${protobuf_VERSION_PATCH})
+  set(ProtobufAlt_VERSION_TWEEK ${protobuf_VERSION_TWEEK})
+elseif(Protobuf_FOUND)
   set(ProtobufAlt_VERSION ${Protobuf_VERSION})
   set(ProtobufAlt_VERSION_MAJOR ${Protobuf_VERSION_MAJOR})
   set(ProtobufAlt_VERSION_MINOR ${Protobuf_VERSION_MINOR})

edit with correct patch

Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

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

Error seems unrelated and I arrived to a really similar patch from the initial pointers.

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Apr 25, 2024
@raulcd
Copy link
Member

raulcd commented Apr 25, 2024

@github-actions crossbow submit verify-rc-source-cpp-macos-arm64

Copy link

Revision: 53157c0

Submitted crossbow builds: ursacomputing/crossbow @ actions-5614ccecdd

Task Status
verify-rc-source-cpp-macos-arm64 GitHub Actions

@kou kou merged commit 64be7a2 into apache:main Apr 26, 2024
33 of 34 checks passed
@kou kou deleted the cpp-cmake-protobuf-config branch April 26, 2024 08:15
@kou kou removed the awaiting merge Awaiting merge label Apr 26, 2024
Copy link

After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 64be7a2.

There were 5 benchmark results indicating a performance regression:

The full Conbench report has more details. It also includes information about 3 possible false positives for unstable benchmarks that are known to sometimes produce them.

raulcd pushed a commit that referenced this pull request Apr 29, 2024
…make (#41360)

### Rationale for this change

`protobuf::libprotobuf` provided by `FindProtobuf.cmake` (provided by CMake) may not provide needed dependencies such as Abseil.

### What changes are included in this PR?

Try `protobuf-config.cmake` provided by Protobuf before `FindProtobuf.cmake`.
`protobuf::libprotobuf` provided by `protobuf-config.cmake` must have needed dependencies.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #41333

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
tolleybot pushed a commit to tmct/arrow that referenced this pull request May 2, 2024
…obuf.cmake (apache#41360)

### Rationale for this change

`protobuf::libprotobuf` provided by `FindProtobuf.cmake` (provided by CMake) may not provide needed dependencies such as Abseil.

### What changes are included in this PR?

Try `protobuf-config.cmake` provided by Protobuf before `FindProtobuf.cmake`.
`protobuf::libprotobuf` provided by `protobuf-config.cmake` must have needed dependencies.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: apache#41333

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…obuf.cmake (apache#41360)

### Rationale for this change

`protobuf::libprotobuf` provided by `FindProtobuf.cmake` (provided by CMake) may not provide needed dependencies such as Abseil.

### What changes are included in this PR?

Try `protobuf-config.cmake` provided by Protobuf before `FindProtobuf.cmake`.
`protobuf::libprotobuf` provided by `protobuf-config.cmake` must have needed dependencies.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: apache#41333

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
CurtHagenlocher pushed a commit to CurtHagenlocher/arrow that referenced this pull request Jun 14, 2024
…obuf.cmake (apache#41360)

### Rationale for this change

`protobuf::libprotobuf` provided by `FindProtobuf.cmake` (provided by CMake) may not provide needed dependencies such as Abseil.

### What changes are included in this PR?

Try `protobuf-config.cmake` provided by Protobuf before `FindProtobuf.cmake`.
`protobuf::libprotobuf` provided by `protobuf-config.cmake` must have needed dependencies.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: apache#41333

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants