Gentoo ccache setup


















Use the distcc-config command on the local clients to set the list of hosts systems running distccd as a service. The following is an example list of host definitions. In most cases, variants of lines 1 and 2 suffice. More information about the syntax used in lines 3 and 4 can be found in the distcc manual page. There are also several other methods of setting up hosts.

See the man page man distcc for more details. If compilations should also occur on the local machine, add localhost in the hosts list. Conversely if the local machine is not to be used to compile, omit it from the hosts list. On a slow machine using localhost may actually slow things down.

Make sure to test the settings in order to tune for best performance. Configure distcc to use the hosts mentioned on the first line in the example:. Distcc also supports a pump mode, by invoking the pump command. This may significantly reduce build time when multiple files are compiled in parallel. It caches preprocessed headers on the server side and, as a result, gets rid of repeated uploading and preprocessing of these header files. To configure a host for pump mode, add the ,cpp,lzo suffix to the hosts definitions.

The same applies to the distcc-config command. If the maximum threads number is not specified, it will default to 4. Setting up Portage to use distcc is easy. It is a matter of enabling the distcc feature, and setting a decent value for the number of simultaneous build jobs as distcc increases the amount of build resources. The use of -lM in the MAKEOPTS variable will prevent spawning too many tasks when some of the distcc cluster hosts are unavailable increasing the amount of simultaneous jobs on the other systems or when an ebuild is configured to disallow remote builds such as with gcc.

This is accomplished by refusing to start additional jobs when the system load is at or above the value of M. While editing the make. Instead it should list exact platform and a few extra flags as necessary for the CPU. Something like:. This is, in some cases, easier than the Portage setup. However, there is a caveat. If ccache is used, then put the distcc location after the ccache one:.

Instead of calling make alone, add in -jN where N is an integer. The value of N depends on the network and the types of computers that are used to compile. A heuristic approach to the right value is given earlier in this article. To make Ccache work with distcc , some prerequisites must be fulfilled:. Furthermore, when it uses ccache , ccache should use the prefix distcc :.

Finally, restart the daemon distccd to adapt all changes:. The second command mkdir will create the first level directories from a to z , 0 to 9 and tmp. The following for loop will then look for the first level directories find.

When the preparation is done, every directory - including the directory ccache itself - must be owned by the user distcc :. But to make absolutely sure, configure it like that. Also, on the remote site, there should be the cached file 2beaa22dc2addc Generally, one can monitor the ccache size using watch "ccache --show-stats" , while compiling. To produce some cached files on the remote site, one can compile small packages like htop and bzip2 on the client:.

Using distcc to bootstrap i. Boot the new box with a Gentoo Linux LiveCD and follow the installation instructions , while keeping track of the instructions in the Gentoo FAQ for information about bootstrapping.

Then configure Portage to use distcc :. Run distcc-config to setup distcc; substitute the host in the example with the IP addresses or hostnames of the participating nodes. Distcc is now set up to bootstrap! You're free to use them and may or may not get more mileage over using the standard ar , nm , and ranlib since they're intended to handle LLVM bitcode which Clang produces when using the -flto flag.

The main place for looking up known failures with Clang is the tracker bug If you hit an issue not reported on Gentoo's Bugzilla already, please open a new bug report and make it block the linked tracker. If the packages being installed are failing, check the logs. Often, packages with errors like the following will need to disable LTO by invoking the compiler-clang environment.

Sometimes a package will fail to compile even when disabling LTO because it requires another package which was compiled using -flto and works incorrectly. You may see an error like this:. Recompile the program causing the failure using your non-LTO environment and then recompile the new program.

This is because Clang uses C99 inline rules by default which do not work with gnu89 code. Clang's optimizer is different from GCC's. As a result, the command-line semantics are different. The differences in language are documented by the project itself. Clang From Gentoo Wiki. Warning Clang doesn't yet have a default PIE configuration switch like GCC does, so it must be enabled manually for now along with other hardening options.

Note Configuring Clang for global usage is best left until after installing Clang and recompiling it with itself. See "Bootstrapping the Clang toolchain" below. Dear All, The first run of gcc compilation has finished. Here is the ccache output: Code:. Posted: Thu Dec 07, pm Post subject: I started the second compilation run on gcc Dear Folks: I have started the second compilation of gcc again.

Here is the output of genlop after 5 minutes: Code:. Every ETA: 44 minutes and 29 seconds. Posted: Thu Dec 07, pm Post subject:. While ccache may store the xgcc code for futher cache hit, when xgcc finally build gcc the code is than different it now use your optimization leading to cache miss ; and if ccache goes hit, again it will do wrong, as it will reinject code built for xgcc in your final gcc step which remove xgcc optimization on gcc code.

Posted: Thu Dec 07, pm Post subject: I upgraded to ccache 3. Dear Folks, I upgraded to ccache 3. I think there were some bugs in 3. I also seem to have Code:. Posted: Thu Dec 07, pm Post subject: I have uninstalled distcc. Dear Folks, Ihave uninstalled distcc. It was not set up any way. Posted: Thu Dec 07, pm Post subject: I think ccache is starting to work a bit.

Dear Folks, I think ccache is starting to work a bit. It is finishing compilations if you sit through them in a shorter time than genlop eta predicts on the second run It does work. I noticed on the ccache samba site that they mention something called cachecc1 which is meant to be a gcc cache ie it would speed up the compilation of gcc itself.

If I would uninstall ccache here and manually install cachecc1 using a make command or something - there is no gentoo package for cachecc1 AFAICT I could compare it. There is also a program called AO written by IBM I think that looks interesting but again there is no gentoo package for it. Comments appreciated. Posted: Thu Dec 07, pm Post subject: Re: compiling gcc itself should be a good test of ccache Posted: Thu Dec 07, pm Post subject: trying ccache out on qtwebengine.

Dear All, Many thanks for the tips and hints here. What I am hearing hear is that ccache is actually OK for my purposes here relative to other compiler optimisers etc.



0コメント

  • 1000 / 1000