Bug 21156

Summary: cmake: FindProtobuf.cmake returns an error instead of noting the library as missing if protobuf-devel is not installed
Product: Mageia Reporter: Samuel Verschelde <stormi-mageia>
Component: RPM PackagesAssignee: Nicolas Lécureuil <mageia>
Status: RESOLVED OLD QA Contact:
Severity: normal    
Priority: Normal CC: geiger.david68210
Version: CauldronKeywords: UPSTREAM
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: cmake CVE:
Status comment:

Description Samuel Verschelde 2017-06-27 14:21:12 CEST
cmake ships with various FindXXX files to allow it to find dependencies. Apparently there's a syntax error in FindProtobuf.cmake:

---
CMake Error at /usr/share/cmake/Modules/FindProtobuf.cmake:357 (file):
  file STRINGS file "/usr/include/google/protobuf/stubs/common.h" cannot be
  read.
Call Stack (most recent call first):
  CMakeLists.txt:17 (find_package)

CMake Error at /usr/share/cmake/Modules/FindProtobuf.cmake:363 (math):
  math cannot parse the expression: " / 1000000": syntax error, unexpected
  exp_DIVIDE, expecting exp_OPENPARENT or exp_NUMBER (2)
Call Stack (most recent call first):
  CMakeLists.txt:17 (find_package)


CMake Error at /usr/share/cmake/Modules/FindProtobuf.cmake:364 (math):
  math cannot parse the expression: " / 1000 % 1000": syntax error,
  unexpected exp_DIVIDE, expecting exp_OPENPARENT or exp_NUMBER (2)
Call Stack (most recent call first):
  CMakeLists.txt:17 (find_package)

CMake Error at /usr/share/cmake/Modules/FindProtobuf.cmake:365 (math):
  math cannot parse the expression: " % 1000": syntax error, unexpected
  exp_MOD, expecting exp_OPENPARENT or exp_NUMBER (2)
---


CMakeLists.txt at line 17 contains: 

find_package(Protobuf REQUIRED)

which seems fine.
Samuel Verschelde 2017-06-27 14:22:05 CEST

Assignee: bugsquad => mageia

Comment 1 Samuel Verschelde 2017-06-27 14:44:19 CEST
This happens when protobuf-devel is not installed, I think, because ${Protobuf_LIB_VERSION} is empty. It should fail gently instead.
Comment 2 Rémi Verschelde 2017-06-27 14:47:20 CEST
Should be reported upstream, they should handle a missing stubs/common.h in https://github.com/Kitware/CMake/blob/1ee2019239751f91958a390aa3dfa24ea603f2f5/Modules/FindProtobuf.cmake#L397-L408 and return that the protobuf library was not found (ideally with an explicit comment about what was missing).

Keywords: (none) => UPSTREAM

Rémi Verschelde 2017-06-27 14:47:59 CEST

Summary: cmake: Syntax error in FindProtobuf.cmake => cmake: FindProtobuf.cmake returns an error instead of noting the library as missing if protobuf-devel is not installed

Comment 3 David GEIGER 2024-03-03 10:18:51 CET
Seems fixed in current cmake from mga9!

Resolution: (none) => OLD
Status: NEW => RESOLVED
CC: (none) => geiger.david68210