-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRAFT: ccache support experiment #22305
base: master
Are you sure you want to change the base?
Conversation
Note that we don't want a /usr/bin/ccache to exist; that makes various build systems guess wildly that we might want to use ccache, and use it with very bad default settings. It is therefore necessary to rename the binary to avoid this incorrect and dangerous autodetection.
Maybe @thunder-coding can have a look at this one, time permitting of course. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want you can look at the PR linked by @TomJo2000 for somethings missing from this PR
export CC=$TERMUX_HOST_PLATFORM-clang | ||
export CPP=$TERMUX_HOST_PLATFORM-cpp | ||
export CXX=$TERMUX_HOST_PLATFORM-clang++ | ||
export AS="ccache-$TERMUX_HOST_PLATFORM-clang" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supporting ability to disable ccache based on a conifg set in .termuxrc would be nice. ccache doesnt always work really well with all builds
Ninja is a very minimal build system (the authors call it meta-build system) and does not try to be smart in anyway and just follows the rules defined in build.ninja. Talking of CMake, yes it can be told to use ccache in CMakeLists.txt but by default it will not try to use ccache unless specified in command line arguments to cmake
No, cmake does not use pre-compiled headers by default unless using |
Thanks! I've looked at that, and making ccache usage a |
As we have no control over the
In the package I looked at, the string Since, again, we cannot control the
Absolutely, but it does appear to be required when using |
We can, and frequently do patch But sidestepping the issue is absolutely preferable to some jury rigged autopatcher.
That could be made a toggle. |
Will there be a plan to support Sccache as well? |
I've looked into using
ccache
to speed up (re)compilation of termux packages, and I think I've got something that works, so I'll leave it here, if nothing else, for the next person to search for "ccache" to find.The basic idea is, of course, to use
ccache /path/to/clang
instead of/path/to/clang
and everything works automatically. It's not quite that easy, for these reasons:clang
, unfortunately, depends on the name of the executable that is invoked to determine its behavior. This requires us to create a new symlinkclang++-18
so we can still properlyexec
the compiler.ccache
binary in the path. We don't want that, so we rename ourccache
binary toccache.local
ccache
limits cache size to 5GB, and includes compression which reduces performance; the current version of this PR also includes debugging flags.cmake
, by default, uses pre-compiled headers, which is a bad idea for many reasons; one of the reasons is that it bustsccache
. Disable that.Sorry for the code drop, but I think the benefits are quite noticeable and probably worth the trouble...