`Protobuf` dependency doesn't work with `cmake` from `brew` on `MacOS`
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C++
- Estrellas
- 492
- Forks
- 130
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con cmake/dependencies.cmake y el CMakeLists.txt de nivel superior; después, reproduce la compilación de Protobuf 3.19.4-p0 usando Homebrew CMake 4 en macOS. Inspecciona la configuración de compilación de Protobuf de Hunter y su CMakeLists.txt de dependencias generado. Se considera terminado cuando el proyecto se compila correctamente con la versión actual de Homebrew CMake sin el error de compatibilidad indicado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cmake, cpp
- Área
- build-system
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100