Developers - if you want must FASTER local builds, install GNU ccache

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Developers - if you want must FASTER local builds, install GNU ccache

Postby blacey » Fri Jul 08, 2016 4:45 am

We recently enabled GNU ccache in the FreeCAD CMake project files on master to drastically reduce Travis build times but these changes also greatly improves local builds, especially if you tend to switch between git branches and/or rm -rf your ./build directory. To reap the benefits, you simply need to install the default ccache however if you use the CLANG compiler, instead of GCC, you should use version 3.25 or later.

On a lowly Travis dual CPU VM, a GCC build dropped from nearly an hour and 10 minutes to just over 7 minutes (10x faster) and the CLANG build dropped from nearly 48 minutes to less than 7 minutes (~7x faster). ccache performance will vary by system but I am confident local compilation will benefit even more from ccache.

GNU ccache has only been verified on Linux and macOS/OS X but it seems there are forks/patches for use with Visual Studio.

For reference here is the recent pull request that enabled ccache. Click through if you want to see the build time benefits and additional context.
ezzieyguywuf
Posts: 650
Joined: Tue May 19, 2015 1:11 am

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby ezzieyguywuf » Fri Jul 08, 2016 1:13 pm

blacey wrote:...here is the recent pull request....
As a sort of PSA, you can reap the benefits of ccache system-wide if you do something similar to what Arch suggests here. This will be system-specific, but essentially putting the ccache stuff ahead of your gcc/gcc-equivalent (and other appropriate build tools) in your PATH (or PATH equivalent) obviates the need for this pull request and enables ccaching on any cc build you may do.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby blacey » Fri Jul 08, 2016 4:20 pm

ezzieyguywuf wrote:As a sort of PSA, you can reap the benefits of ccache system-wide if you do something similar to what Arch suggests here.
Correct but not for the CLANG compiler.
User avatar
saso
Posts: 1508
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby saso » Fri Jul 22, 2016 7:21 pm

This is awesome bruce! It really makes travis as usefully as one would wish for... I am away for a bit and everything gets so much better! :roll: ;)
jrlogicle
Posts: 1
Joined: Fri Jan 19, 2018 5:37 am

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby jrlogicle » Fri Jan 19, 2018 5:41 am

If you are using MSVC as a target in CMake and want similar cache capabilities, you might want to look at Stashed (https://stashed.io)
User avatar
Kunda1
Posts: 7683
Joined: Thu Jan 05, 2017 9:03 pm

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby Kunda1 » Fri Jan 19, 2018 3:24 pm

jrlogicle wrote:
Fri Jan 19, 2018 5:41 am
If you are using MSVC as a target in CMake and want similar cache capabilities, you might want to look at Stashed (https://stashed.io)
Cool. Do you mind opening a up a new thread in regards to Stashed?
Also have you used it? Would you be willing to share your methodology?

Also, since this thread has been necrobumped already, I'll just leave this here. As of this moment we don't have much documentation on the wiki on how to use ccache. Whomever has a experience and a moment, please feel free to populate our ccache wiki page with instructions on how to enable it. Thanks!
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby triplus » Fri Jan 19, 2018 3:40 pm

Whenever relevant i don't mind the bump (with at least a reference link to the new thread). If it turns out something is not relevant moderator can split the thread in new thread. That is i guess whenever there is a need for that (as the original thread gets way off topic). Usually there is no need to do that as the "off topic" part is considered negligible.
User avatar
Kunda1
Posts: 7683
Joined: Thu Jan 05, 2017 9:03 pm

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby Kunda1 » Mon Jul 08, 2019 6:29 pm

Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
qingfeng.xia
Posts: 209
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford Uk
Contact:

Re: Developers - if you want must FASTER local builds, install GNU ccache

Postby qingfeng.xia » Mon Sep 16, 2019 9:38 pm

Kunda1 wrote:
Mon Jul 08, 2019 6:29 pm
More information found at https://github.com/qingfengxia/FreeCAD_ ... ompilation
The link was a bit outdated, here is the 2019 one https://github.com/qingfengxia/FreeCAD_ ... t_debug.md

Always download the latest pdf build from
https://github.com/qingfengxia/FreeCAD_ ... master/pdf
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Currently I mainly work on OpenFOAM + Fenics for CFD, FSI
https://github.com/qingfengxia/FreeCAD_Mod_Dev_Guide
https://github.com/qingfengxia/Cfd