Bug 402881

Summary: ccache and icecream should work together
Product: [Fedora] Fedora Reporter: Michal Schmidt <mschmidt>
Component: ccacheAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-30 00:27:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
teach ccache about icecream none

Description Michal Schmidt 2007-11-28 14:50:47 UTC
Description of problem:
icecream is a distributed compiler (see http://en.opensuse.org/Icecream). 
icecream is in Rawhide. If both ccache and icecream are installed, icecream is 
effectively disabled. Compilation jobs are handled by ccache, but cache misses 
are not passed to icecream.

Version-Release number of selected component (if applicable):
ccache-2.4-11

How reproducible:
always

Steps to Reproduce:
1. Install icecream on a few machines on LAN, run icecc-scheduler on one of 
them, run iceccd on all of them (including your own). Install ccache on your 
own computer.
2. Login on your machine. Notice that 'which gcc' points to ccache (that's 
fine and expected).
3. Compile a kernel or something else with -j20. Notice that your ccache cache 
is being populated, but since ccache does not know about icecream, the compile 
jobs are not distributed to the other machines.
  
Actual results:
Everything is compiled locally.

Expected results:
Compile jobs should be distributed to other nodes running iceccd.

Additional information:
The attached patch makes ccache aware of icecream.

Comment 1 Michal Schmidt 2007-11-28 14:50:47 UTC
Created attachment 271341 [details]
teach ccache about icecream

Comment 2 Ville Skyttä 2007-11-28 18:30:31 UTC
Looks pretty sane at first sight, some comments though.

I'm slightly worried about unconditionally overriding $PATH that way.  Wouldn't
that produce unexpected results if let's say a user wishes to use a real
compiler executable from /usr/local/bin (which comes before /usr/bin in the
default Fedora $PATH)?

Also, I'm not quite sure what the conditional in the wrapper script is for -
wouldn't it work to just always prepend $libdir/icecc/bin to $PATH?  See eg.
http://gentoo-wiki.com/HOWTO_Setup_An_ICECREAM_Compile_Cluster#Icecream_and_ccache
(There's also a link to a C wrapper on that page which could be a bit faster
than invoking the shell)

Perhaps also doing 'exec ccache $compiler "$@"' instead of 'ccache $compiler
"$@"' could be a slight optimization (if the C wrapper above would not be used)?

Does ccache need to be invoked with hardcoded full path in the wrapper rather
than just invoking it as "ccache"?

Comment 3 Michal Schmidt 2007-11-29 12:17:08 UTC
Good points. I'll play with it some more and see what works best.

Comment 4 Michal Schmidt 2007-11-30 00:27:24 UTC
Actually no changes in ccache are required. In my earlier testing I had the 
order of icecream and ccache in PATH reversed. This didn't work, icecc 
complained about being called recursively.

Now that I have ccache before icecream in PATH it works fine. No new wrapper 
is needed.

There was a problem with the order of scripts in profile.d. They are sourced 
in the collating order for the user's locale. To have ccache before icecream 
in PATH, I wanted to have icecream.sh sourced before ccache.sh. I tried 
renaming icecream.sh to cc-icecream.sh. This worked in C locale, but not with 
my usual cs_CZ.UTF-8. Instead, I modified icecream.sh to insert icecc after 
ccache in PATH if it finds it there. It is in icecream-0.8.0-6.20071101svn 
which I'm building in Koji right now.

Closing this bug.

Comment 5 Ville Skyttä 2007-11-30 16:46:55 UTC
Thanks for the followup.  If you ask me, locale dependent order of sourcing
/etc/profile.d snippets from /etc/profile would qualify as a bug in the "setup"
package though...