Details
- Reviewers
gateau
Diff Detail
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Is this really necessary? Building with ccache is usually just a matter of making sure /usr/lib/ccache comes first in $PATH. Or am I missing something?
As far as I know this is the official way to add ccache support to CMake, it does not work out-of-box. And it is disabled by default as you can see, it does not have any side-effect on normal build.
It works for me:
[perso ~/src/colorpick/build] $ which gcc /usr/lib/ccache/gcc [perso ~/src/colorpick/build] $ cmake -G Ninja .. -- The C compiler identification is GNU 6.2.0 -- The CXX compiler identification is GNU 6.2.0 -- Check for working C compiler using: Ninja -- Check for working C compiler using: Ninja -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler using: Ninja -- Check for working CXX compiler using: Ninja -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/perso/src/colorpick/build [perso ~/src/colorpick/build] $ ccache -s cache directory /home/perso/.ccache primary config /home/perso/.ccache/ccache.conf secondary config (readonly) /etc/ccache.conf cache hit (direct) 297 cache hit (preprocessed) 15 cache miss 1390 called for link 1126 called for preprocessing 167 multiple source files 1 compile failed 80 preprocessor error 7 no input file 64 files in cache 1379 cache size 39.5 MB max cache size 1.1 GB [perso ~/src/colorpick/build] $ ninja [1/14] Automatic moc for target colorpick Generating moc_coloreditor.cpp Generating moc_colorpicker.cpp Generating moc_componenteditor.cpp Generating moc_contrastpreview.cpp Generating moc_window.cpp [14/14] Linking CXX executable src/colorpick [perso ~/src/colorpick/build] $ ccache -s cache directory /home/perso/.ccache primary config /home/perso/.ccache/ccache.conf secondary config (readonly) /etc/ccache.conf cache hit (direct) 297 cache hit (preprocessed) 15 cache miss 1401 called for link 1127 called for preprocessing 167 multiple source files 1 compile failed 80 preprocessor error 7 no input file 64 files in cache 1412 cache size 40.0 MB max cache size 1.1 GB
We can see ccache was used because the number of cache miss increased.
Having said that, I am not against the change, especially if this is something which has been done in other KDE repositories, but it looks unnecessary to me.
I already added this to KStars repo earlier and I use it daily.
The problem with the /usr/lib/ccache/ links that they are not generated correctly for all compilers.
For example, I have couple of clang versions installed:
dpkg -l | grep clang-
ii clang-3.8 1:3.8-2ubuntu4 amd64 C, C++ and Objective-C compiler (LLVM based)
ii clang-3.9 1:3.9.1-4ubuntu3~16.04.1 amd64 C, C++ and Objective-C compiler (LLVM based)
ii clang-4.0 1:4.0-1ubuntu1~16.04.2 amd64 C, C++ and Objective-C compiler (LLVM based)
But link was only created for clang++ in /usr/lib/ccache/:
ls /usr/lib/ccache/clang*
/usr/lib/ccache/clang++