All the paths like /opt/local/var/macports/build/rootHGGlRz need to go
back to something predictable and stable for each port build for the
ccache option to be useful again.
This means that ccache was already effectively unable to cache results
for (unchanged) files across version updates, right?
Yes, but thats much less a problem. The main problem right now is I
cannot rebuild a large port like LLVM with a trivial fix to the port,
that doesn't change the version etc. and utilize the hot ccache. The
random string renders it useless.
It looks like the
solution according to the ccache docs is to pass relative paths to the
compiler. I don't know how to make LLVM's build system do that.
I don't think we can blame upstream projects for this, and fixing *all*
of them to work with a change we have made on our side does not seem
reasonable to me.
There are some environment variables that might work around the issue:
<https://ccache.dev/manual/latest.html#_configuration_options>
The problem with those options is they all effectively change the build
command that is run, replacing paths. Maybe you could get that approach
to work for *one* upstream project, if that is all we needed to fix, but
getting something to work again for all port build seems unfeasible.
The trouble with predictable work dir names is that it's basically
impossible for them to be both short and guaranteed to be unique. It
might be possible for them to be somewhat "sticky" (likely to stay the
same for the same port), though that would require some state to survive
a clean, which we don't currently have a way of doing.
I think this is effectively the only fix, find a way to have something
slightly less random than we have now. Maybe some sort of string hash of
meta-data related to the port that results in a 'random' string but one
that doesn't change if the port is rebuilt with no portfile changes, or
just small ones (that don't e.g. change the port version or things like
that).
Or, whenever the ccached option is enable just go back to what we where
doing before and accept the longer path names might cause issues in some
cases...
- Josh