Bug 246245

Summary: Mk/bsd.ccache.mk: Increase ccache hit ratio
Product: Ports & Packages Reporter: rozhuk.im
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Open ---    
Severity: Affects Many People CC: bdrewery, dewayne, ports-bugs, rozhuk.im
Priority: --- Keywords: needs-qa, performance
Version: LatestFlags: koobs: exp-run?
Hardware: Any   
OS: Any   
URL: https://ccache.dev/manual/3.7.9.html#_compiling_in_different_directories
Description Flags
patch none

Description rozhuk.im 2020-05-06 03:53:24 UTC
Created attachment 214185 [details]

Make ccache more efficient.

Port system builds every port in folders with different names, this broke ccache hit ratio.
With this patch last chromium update take ~20 minutes, not 1 hour 30 minutes as usual.
Comment 1 Sunpoet Po-Chuan Hsieh freebsd_committer 2020-05-06 15:44:42 UTC
Assign PR to the maintainer.
Comment 2 Bryan Drewery freebsd_committer 2020-06-15 17:07:04 UTC
Yes this patch makes sense. I haven't tested it though.
Comment 3 Mathieu Arnold freebsd_committer 2020-06-15 17:35:06 UTC
Do we need an exp-run because of the CFLAGS change?
Comment 4 Bryan Drewery freebsd_committer 2020-06-15 17:40:47 UTC
(In reply to Mathieu Arnold from comment #3)

It wouldn't hurt. I do worry that it will regress some ports that somehow see
the MAKE_ENV but don't care about CFLAGS passed in. Not worth blocking it on those though as they are already losing all caching on version bumps due to changed workdir name.
Comment 5 dewayne 2020-06-16 02:15:13 UTC
(In reply to Bryan Drewery from comment #4)
The proposed CFLAG change option isn't available in the man pages of clang nor gcc9, so the begging question is: how will this change affect those that have a development/debugging environment.  (Hopefully none).  

Conversely for those that turn off debugging in their CFLAGS (-g0), does this option become a noop?  (I'm afraid that I'm overly cautious when something may be added to binaries)
Comment 6 rozhuk.im 2020-06-16 03:44:15 UTC
(In reply to dewayne from comment #5)

-fdebug-prefix-map=${WRKSRC}=. - documented option.

Then some one make debug build in backtrace or whatever then will see main.c not /tmp/ports/***/***/someapp-1.33.55/main.c.
This allow ccache to cache files even then path to file changed.
In our port system path changed on app version update.
Comment 7 dewayne 2020-06-16 04:10:41 UTC
(In reply to rozhuk.im from comment #6)
Thank-you.  After reviewing your references and poking around in 
# find /usr/src/ | xargs grep debug-prefix-map
files I can see little to be concerned. Cheers.