[Replicant] Introducing ccache to Replicant 6
Denis 'GNUtoo' Carikli
GNUtoo at cyberdimension.org
Wed Apr 15 17:40:53 UTC 2020
On Thu, 2 Apr 2020 13:58:37 +0200
Tobias Tefke <tefke at stud.fh-sm.de> wrote:
> Hi,
Hi, sorry for the delay and thanks a lot for the patch.
> The following patch set introduces ccache to Replicant 6.
>
> Ccache is a compiler cache for C/C++ [1] licensed under the GNU GPL
> version 3 [2].
>
> Including it speeds up the build time for me about 1/3.
Do you know if there are downsides in using it?
Is it reliable all the time or are there some situations where you need
to disable ccache in order to force the rebuilding of the cache.
In any way as I understand it, it is disabled by default, so if you
don't know it shouldn't be a problem.
But if you know about potential issues, we could mention them in the
build instruction in the wiki, once we add information about ccache
there, as people will read that information before building.
> The following environment variables can be set to use ccache:
>
> USE_CCACHE: setting it enables ccache during the build [3]
>
> CCACHE_DIR: allows to set a custom directory where compiled files are
> cached.
>
> Otherwise the files will be stored at $HOME/.ccache [4]
> Patches:
> The first patch must be applied to the manifest to track the latest
> stable version available on GitHub:
[...]
> + <remote name="github"
> + fetch="https://github.com" />
> +
[...]
> +<project path="toolchain/src/ccache" name="ccache/ccache.git"
> revision="3.7-maint" remote="github" />
We typically mirror projects we use to make sure we still have the
source code.
As we are starting to mirrors too many projects we probably need to
rework a bit our mirror system but in the meantime I've mirrored it in
the contrib area of our git repositories here:
https://git.replicant.us/contrib/ccache-mirror/ccache/
> ---
> core/ccache.mk | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/core/ccache.mk b/core/ccache.mk
> index bd60ebf26..2414a6be3 100644
> --- a/core/ccache.mk
> +++ b/core/ccache.mk
> @@ -39,17 +39,25 @@ ifneq ($(USE_CCACHE),)
> export CCACHE_CPP2 := true
>
> # Detect if the system already has ccache installed to use instead
> of the prebuilt
> - ccache := $(shell which ccache)
> + #ccache := $(shell which ccache)
>
> - ifeq ($(ccache),)
> - CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
> + #ifeq ($(ccache),)
> + #CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
In this case I think it's better to completely remove the commented
code. You could replace them by some text based on the comment you
added below (replacing the "we don't need the commented line above"
part along the way as the lines will no longer be commented but
completely removed)
> # If we are cross-compiling Windows binaries on Linux
> # then use the linux ccache binary instead.
> - ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
> - CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
> - endif
> - ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
> - endif
> + #ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
> + # CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
> + #endif
> + #ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
> + #endif
Same here, you could simply remove the commented code.
> + # We don't need the commented lines above.
> + # We should't check for a prebuilt version of ccache because
> + # we should build the binaries we use ourself.
> + # The only platform Replicant should be built on is GNU/Linux.
> + # Therefore we don't need binaries for other platforms.
> + # This allows us to directly include the binary we built for our
> toolchain.
> + ccache := toolchain/ccache/ccache
[...]
> The last patch must be applied to vendor/replicant to build our own
> ccache binary while building the toolchain:
>
>
> From 3326ad820b94d4d779edf3721d25bda19206b42b Mon Sep 17 00:00:00 2001
> From: Tobias Tefke <t.tefke at stud.fh-sm.de>
> Date: Thu, 2 Apr 2020 13:32:24 +0200
> Subject: [PATCH] [3/3] toolchain: build ccache
>
> Signed-off-by: Tobias Tefke <t.tefke at stud.fh-sm.de>
> ---
> build-toolchain | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/build-toolchain b/build-toolchain
> index 727bd81b..1046ebba 100755
> --- a/build-toolchain
> +++ b/build-toolchain
> @@ -182,4 +182,13 @@ cd ../src/jill
> ant clean dist
> cp ../../jack_jill/build/jill/dist/jill.jar ../../jack_jill/
>
> +# ccache
> +mkdir -p $BASEDIR/toolchain/ccache
> +cd ../ccache
> +./autogen.sh
> +./configure
> +make
> +cp ccache ../../ccache
> +make clean
> +
> cd $BASEDIR
Is there an advantage in building ccache when most GNU/Linux
distributions already have it?
Is it for making the build more reproducible?
Is it to make it more easy and have less dependencies?
I'll try to be faster for the review of your next version of this patch.
Thanks again.
Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20200415/97363366/attachment.asc>
More information about the Replicant
mailing list