cmake does not work well with ccache

Bug #773062 reported by Vladislav Vaintroub
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cmake (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: cmake

Using Ubuntu 11.04, trying to use CMake with ccache via
export CC='ccache gcc'
export CXX='ccache g++'

results in a lot (once per system check) of output like below during cmake run. It looks like ccache was invoked with wrong parameter . If I use compiled cmake 2.8.4 from source , this does not happen.

Output
-- Check for working CXX compiler: /usr/bin/ccache
/usr/bin/ccache: invalid option -- 'd'
Usage:
    ccache [options]
    ccache compiler [compiler options]
    compiler [compiler options] (via symbolic link)

Options:
    -c, --cleanup delete old files and recalculate size counters
                          (normally not needed as this is done automatically)
    -C, --clear clear the cache completely
    -F, --max-files=N set maximum number of files in cache to N (use 0 for
                          no limit)
    -M, --max-size=SIZE set maximum size of cache to SIZE (use 0 for no
                          limit; available suffixes: G, M and K; default
                          suffix: G)
    -s, --show-stats show statistics summary
    -z, --zero-stats zero statistics counters

    -h, --help print this help text
    -V, --version print version and copyright information

See also <http://ccache.samba.org>.
dpkg-architecture: warning: Couldn't determine gcc system type, falling back to default (native compilation)

Revision history for this message
Rico Zoss (rico.zoss) wrote :

I can confirm this bug. Compiling the newest veriosn of cmake (2.8.4) solve the problem.

Revision history for this message
Eddy Pronk (epronk) wrote :

Ironically ccache is a workaround for broken build systems.

Revision history for this message
Harald Sitter (apachelogger) wrote :

<apachelogger> ScottK: that cmake bug looks like fun btw
<apachelogger> also I do not think it is a cmake issue at all
<apachelogger> or perhaps it is, but only partially
<apachelogger> in particular it is probably falling over the fact that cxx has a cmd and a arg, which generally speaking of course is a bit of a bogus situation
<apachelogger> yeah
<apachelogger> gcc got three args with -d
<apachelogger> cmake does not call either
-*- apachelogger runs cmake with tracing
<apachelogger> /usr/share/cmake-2.8/Modules/Platform/UnixPaths.cmake(32): EXECUTE_PROCESS(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH OUTPUT_VARIABLE CMAKE_ARCH_TRIPLET OUTPUT_STRIP_TRAILING_WHITESPACE )
<apachelogger> Called from: [4] /usr/share/cmake-2.8/Modules/Platform/UnixPaths.cmake
<apachelogger> [3] /usr/share/cmake-2.8/Modules/Platform/Linux.cmake
<apachelogger> [2] /usr/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake
<apachelogger> [1] /home/me/src/git/libechonest/CMakeLists.txt
<apachelogger> /usr/bin/ccache: invalid option -- 'd'
<apachelogger> 5 bucks that call comes from a patch
<apachelogger> me@osiris:/tmp/cmake-2.8.4+dfsg.1$ grep -ri dpkg-architecture .
<apachelogger> ./debian/patches/ubuntu_multiarch_library_directory.diff:+EXECUTE_PROCESS(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH OUTPUT_VARIABLE CMAKE_ARCH_TRIPLET OUTPUT_STRIP_TRAILING_WHITESPACE)
<debfx> what's wrong with it?
<apachelogger> well, it causes ccache -dumpmachine to be called
<apachelogger> leading to an eror in ccache
<apachelogger> as obviously the call should be ccache gcc -dumpinfo
<apachelogger> eh
<apachelogger> dumpmachine
<apachelogger> debfx: perhaps the patch was applied differently upstream?
<debfx> how does ccache hook into the buildsystem? does it modify $PATH?
<apachelogger> no
<apachelogger> you set a new CXX and CC env var
<apachelogger> debfx: multiarch is something gcc, that should totally be implemented in cmake upstream
<apachelogger> anyhow
<apachelogger> for some reason dpkg-architecture calls:
<apachelogger> execve("/bin/sh", ["sh", "-c", "${CC:-gcc} -dumpmachine"], [/* 50 vars */]) = 0
<apachelogger> resulting in
<apachelogger> execve("/usr/bin/ccache", ["/usr/bin/ccache", "-dumpmachine"], [/* 50 vars */]) = 0
<apachelogger> which then produces crap outs
<apachelogger> I believe cmake pokes the env around a bit
<apachelogger> I know that it definitely stores CC/CXX as a combo of command + argN
<apachelogger> so if cmake were to set its envrionemnt so that CC only contains the command and no the arg (which is generally sane behaviour I suppose), that would screw over the poor old dpkg-architecture

Revision history for this message
Harald Sitter (apachelogger) wrote :

Thus I do not think we can SRU this, as it is not even quite sure which tool actually screws up, nor which part of that tool.

Revision history for this message
Felix Geyer (debfx) wrote :

Fixed in oneiric as the new multiarch patch doesn't call dpkg-architecture anymore.

Changed in cmake (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.