yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #14786
Re: Make ccache working
Thanks for your help. I'm on kubuntu 18.04 (cmake 3.10.2), and maybe our
versions mismatch is at the origin of the issue (I finally found a
solution, see the bottom of this message).
By "installing" ccache I meant in fact "enable/use" ccache, I also
installed it with "apt install ccache". Of course, I always start from an
empty build dir.
Now I restarted everything with a clean $PATH, reverting my changes. Using
export CC and CXX doesn't work:
> export CC="ccache gcc"
> export CXX="ccache g++"
> cmake -DCMAKE_INSTALL_PREFIX=../install ../trunk
> [...]
> *ccache: error: Could not find compiler "g++" in PATH*
>
Somebody had the same issue here:
https://github.com/bazelbuild/bazel/issues/3642 so I tried unsuccessfully :
> rm -r *
> export CC="ccache /usr/bin/gcc"
> export CXX="ccache /usr/bin/g++"
> cmake -DCMAKE_INSTALL_PREFIX=../install ../trunk
> [...]
> */usr/bin/ccache: invalid option -- 'd'*
>
I didn't found exactly why, but somewhere the "-d" option is passed
directly to ccache (instead of gcc/g++ I assume), but not in your 16.04
system.
So I tried two methods to use $PATH instead of $CXX and $CC:
- the one in ccache documentation, with symlinks :
https://ccache.samba.org/manual/latest.html#_run_modes
- the one we can find everywhere with export PATH="/usr/lib/ccache:$PATH"
But the result is finally the same as above.
*OUTCOME*:
I feel a bit confused as I spent some time to make it work to finally see
that cmake handles ccache since version 3.4:
https://cmake.org/cmake/help/v3.6/release/3.4.html#variables
Without environment variables nor symlinks, the solution basically is to
run cmake with "*-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_C_COMPILER_LAUNCHER=ccache*"
Now ccache is activated, after a successful build I have 720.9 MB in cache,
yade full build in 30s yeepee :-D
This solution should also work for ubuntu 16.04 as it carries cmake 3.5,
but not for ubuntu 14.04.
NB: Interestingly, compiling [yade with python 3] for the first time with
the full ccache of [yade with python 2.7] took about 5 mins against about
30min for a full uncached build.
Cheers,
François
Le mer. 27 mars 2019 à 20:40, Bruno Chareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
a écrit :
> I checked your ubuntu 12.04 page again. That's actually about hiding
> ccache behind normal gcc invocation, and I kind-of dislike the idea.
> Explicit call to «ccache g++» sounds cleaner to me and it is compatible
> with mpicxx (for ubuntu 16.04 at least).
> Better undo what you have done until now in terms of ccache hacks and
> stick to yade doc's method if you are unsure.
>
> «ccache -s» also reports unsupported options on my ubuntu 16.04 but a full
> rebuild takes 40sec regardless.
>
> Bruno
>
> Le mer. 27 mars. 2019 19:46, Bruno Chareyre <
> bruno.chareyre@xxxxxxxxxxxxxxx> a écrit :
>
>> Also, did you start from fresh build after exporting CXX?
>> I mean:
>> rm -rf ./*
>> export ...
>> cmake [options]
>> make -jN
>>
>> Bruno
>>
>> Le mer. 27 mars. 2019 18:33, Bruno Chareyre <
>> bruno.chareyre@xxxxxxxxxxxxxxx> a écrit :
>>
>>> Hi François,
>>>
>>> Please remember to give your linux version.
>>>
>>> On Wed, 27 Mar 2019 at 17:44, François <francois.kneib@xxxxxxxxx> wrote:
>>>
>>>> export CXX=ccache g++
>>>>
>>>>> bash: export: « g++ » : identifiant non valable
>>>>>
>>>> Using
>>>>
>>>>> export CXX='ccache g++'
>>>>
>>>> works
>>>>
>>>
>>> Thanks for pointing that out. I forgot the " indeed, I'll fix it.
>>> It would be useful to turn your bash to english for pasting errors here
>>> (also much more efficient when searching online solutions).
>>>
>>>
>>>
>>>> but it will result in cmake fail while checking cc compiler.
>>>> Finally, I "installed" ccache thanks to the first answer here:
>>>> https://askubuntu.com/questions/470545/how-do-i-set-up-ccache and it
>>>> *kinda* works.
>>>>
>>>
>>> Arguably, using ccache is assuming that it is installed. ;)
>>> Not sure why you needed that ubuntu 12.04 forum, as far as I remember I
>>> only had to "apt-get install ccache".
>>>
>>>
>>>>
>>>> - the second one, once the install is ok and cmake uses ccache, is
>>>> that I only get "unsupported compiler option" when I try *ccache -s*
>>>> after a full yade compilation. It results in a almost-empty cache:
>>>>
>>>>
>>> Does compilation work?
>>> Could you send cmake output, and some sample of "make VERBOSE=1"?
>>>
>>> I have this:
>>>
>>> *[ 39%] Building CXX object
>>> CMakeFiles/yade.dir/pkg/dem/Ig2_Box_Sphere_ScGeom.cpp.o/usr/bin/ccache
>>> g++ -DBOOST_MATH_DISABLE_FLOAT128=1 -DNDE...*
>>>
>>> Cheers
>>>
>>> Bruno
>>>
>>> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References