Bug 923024

Summary: cmake should pull in gcc-c++ as a runtime dependency
Product: [Fedora] Fedora Reporter: Michel Lind <michel>
Component: cmakeAssignee: Orion Poplawski <orion>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: jreznik, ltinkl, orion, pertusus, pmachata, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-20 02:39:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michel Lind 2013-03-19 03:11:57 UTC
Description of problem:
Cmake is normally used to build C++ programs, so this is not often an issue. However, today I'm trying to compile Granite (part of Elementary OS), which is written in Vala but uses Cmake as its build system.

There is no mention of CXX -- or any C++ source files -- in the Granite tree (it does the normal Vala->C->binary compilation process), but the cmake invocation would still fail if g++ is not detected.

If the test for CXX cannot be disabled, perhaps the Cmake package should just add gcc-c++ as a runtime dep?

(note: I tried installing gcc-c++ but renaming the compiler binary to g++.bak, ensuring that any attempt to use it will fail -- CMake picked up that C++ is installed but the compilation still succeeds, so the CXX test is definitely not needed)

Version-Release number of selected component (if applicable):
cmake-2.8.10.2-3.fc18.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install cmake
2. Remove gcc-c++
3. Try and compile Granite: https://code.launchpad.net/granite
  
Actual results:
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.


Expected results:
CMake should either not assume a project depend on a C++ compiler by default, or the packaging should depend on it.

Additional info:

Comment 1 Petr Machata 2013-03-19 11:23:21 UTC
(In reply to comment #0)
> (note: I tried installing gcc-c++ but renaming the compiler binary to
> g++.bak, ensuring that any attempt to use it will fail -- CMake picked up
> that C++ is installed but the compilation still succeeds, so the CXX test is
> definitely not needed)

Are you sure it didn't just try "gcc -x c++", or even simply "cc -c test.cc"?  You don't have to go through the g++ driver to compile C++ code.

Comment 2 Michel Lind 2013-03-19 14:03:13 UTC
No mention of c++ or cc anywhere in the source tree. Though I'm not that familiar with CMake internals, so someone more knowledgeable should probably check if there is something wrong in the various CMakeFiles in the project.

  $ bzr branch lp:granite

Comment 3 Orion Poplawski 2013-03-19 17:32:18 UTC
Why not just ignore the error?  I don't believe it causes any problems.

Comment 4 Michel Lind 2013-03-20 02:06:31 UTC
(In reply to comment #3)
> Why not just ignore the error?  I don't believe it causes any problems.

On the build systems, no problem because gcc-c++ is part of the default environment. On user systems, it could cause some surprise for non-C++-developers such as myself

Comment 5 Orion Poplawski 2013-03-20 02:39:24 UTC
C++ is enabled in cmake by default.  If the project does not use it then it should state explicitly the language(s) it uses, e.g.:

project (granite C)

Comment 6 Michel Lind 2013-03-20 02:54:10 UTC
Aha, thanks, that indeed fixes the problem. Filing a bug with upstream