Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`Protobuf` dependency doesn't work with `cmake` from `brew` on `MacOS`

オープン
#324 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cmake, cpp
領域
build-system

調査の方向性

cmake/dependencies.cmake とトップレベルの CMakeLists.txt から始め、macOS 上で Homebrew CMake 4 を使用して Protobuf 3.19.4-p0 のビルドを再現します。Hunter の Protobuf ビルド構成と、生成された依存関係用の CMakeLists.txt を調査します。現在の Homebrew CMake バージョンで、報告された互換性エラーなしにプロジェクトのビルドが成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

Trying to build with cmake from brew on MacOS, on , we get the following error with the Protobuf dependency:

CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

This is caused by the first line in the dependency's CMakeLists.txt:

cmake_minimum_required(VERSION 3.2)

This happens because cmake version 4 removed compatibility with CMake < 3.5, and brew on MacOS does not offer an older version of cmake.

Passing the suggested -DCMAKE_POLICY_VERSION_MINIMUM=3.5 on the command line does not fix this.

Expected behavior

Build is successful on MacOS using the current versions of tools available in the default package manager brew.

Actual behavior

Build fails with the above error, due to incompatibility between the Protobuf dependency and the current version of cmake available on this platform.

Relevant log output
-- [hunter] PROTOBUF_ROOT: /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/Install (ver.: 3.19.4-p0)
-- [hunter] Building Protobuf
loading initial cache file /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/cache.cmake
loading initial cache file /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/Build/Protobuf/args.cmake
-- The C compiler identification is AppleClang 17.0.0.17000013
-- The CXX compiler identification is AppleClang 17.0.0.17000013
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/Build/Protobuf/Build
[  6%] Creating directories for 'Protobuf-Release'
[ 12%] Performing download step (download, verify and extract) for 'Protobuf-Release'
-- verifying file...
       file='/Users/axoloki/.hunter/_Base/Download/Protobuf/3.19.4-p0/e5b797d/v3.19.4-p0.tar.gz'
-- File already exists and hash match (skip download):
  file='/Users/axoloki/.hunter/_Base/Download/Protobuf/3.19.4-p0/e5b797d/v3.19.4-p0.tar.gz'
  SHA1='e5b797dbc4e6ad92d0924ae86c130be4354c35b6'
-- extracting...
     src='/Users/axoloki/.hunter/_Base/Download/Protobuf/3.19.4-p0/e5b797d/v3.19.4-p0.tar.gz'
     dst='/Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/Build/Protobuf/Source'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 18%] No update step for 'Protobuf-Release'
[ 25%] No patch step for 'Protobuf-Release'
[ 31%] Performing configure step for 'Protobuf-Release'
loading initial cache file /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/cache.cmake
loading initial cache file /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/Build/Protobuf/args.cmake
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.


-- Configuring incomplete, errors occurred!
make[2]: *** [Protobuf-Release-prefix/src/Protobuf-Release-stamp/Protobuf-Release-configure] Error 1
make[1]: *** [CMakeFiles/Protobuf-Release.dir/all] Error 2
make: *** [all] Error 2

[hunter ** FATAL ERROR **] Build step failed (dir: /Users/axoloki/.hunter/_Base/15ca502/106fd1a/00f4bd3/Build/Protobuf
[hunter ** FATAL ERROR **] [Directory:/Users/axoloki/.hunter/_Base/Download/Hunter/0.25.3-qdrvm36/15ca502/Unpacked/cmake/projects/Protobuf]

------------------------------ ERROR -----------------------------
    https://hunter.readthedocs.io/en/latest/reference/errors/error.external.build.failed.html
------------------------------------------------------------------

CMake Error at /Users/axoloki/.hunter/_Base/Download/Hunter/0.25.3-qdrvm36/15ca502/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
Call Stack (most recent call first):
  /Users/axoloki/.hunter/_Base/Download/Hunter/0.25.3-qdrvm36/15ca502/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page)
  /Users/axoloki/.hunter/_Base/Download/Hunter/0.25.3-qdrvm36/15ca502/Unpacked/cmake/modules/hunter_download.cmake:623 (hunter_fatal_error)
  /Users/axoloki/.hunter/_Base/Download/Hunter/0.25.3-qdrvm36/15ca502/Unpacked/cmake/projects/Protobuf/hunter.cmake:200 (hunter_download)
  /Users/axoloki/.hunter/_Base/Download/Hunter/0.25.3-qdrvm36/15ca502/Unpacked/cmake/modules/hunter_add_package.cmake:62 (include)
  cmake/dependencies.cmake:36 (hunter_add_package)
  CMakeLists.txt:75 (include)
Possible Solution

Update the Protobuf dependency, or add a patch to the build process to address this issue.

Version

Error occurs with both tag v0.1.37 and master branch.

Would you like to work on fixing this bug ?

Yes

主要言語
C++
スター
492
フォーク
130
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

libp2p/cpp-libp2p のほかの issue

libp2p/cpp-libp2p の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。