From owner-freebsd-questions@FreeBSD.ORG Mon Aug 13 05:26:30 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8370816A41B for ; Mon, 13 Aug 2007 05:26:30 +0000 (UTC) (envelope-from mkhitrov@gmail.com) Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.187]) by mx1.freebsd.org (Postfix) with ESMTP id 5B0A113C45D for ; Mon, 13 Aug 2007 05:26:30 +0000 (UTC) (envelope-from mkhitrov@gmail.com) Received: by rv-out-0910.google.com with SMTP id f1so955256rvb for ; Sun, 12 Aug 2007 22:26:30 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eBVTVXBLM7u/P6pdCpzzVhqx+ViTEIjgbKVqGicU2KkeFrpAL5KHBHxBFGj2+el3sokfiYObSPLhvWMwkt0cYVrllaFv76w1Fz9qP0apfGfKxVlfinaLBwSWSoI5RWx0eGnvULYIDMNR8CF2Ei3BG88QCV+mZdSZgeqF/WEamzM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UomsOmZw3pUR089Ynk1XsAzMZY4R0r8S/l+9mICf1ez5JINqx2Dw/aNw3vi4ynNnKCAHcNsGgIH2AgA82sVSN/lJ5LMpMFWrRO8tDeXGCN+8uwj1+Ulqi4sR0zq3ZoqGwn/MwYqzWosVoCBStxJKqYMQp+ZsUlVF78jm+EB2sI0= Received: by 10.142.157.15 with SMTP id f15mr662957wfe.1186982789970; Sun, 12 Aug 2007 22:26:29 -0700 (PDT) Received: by 10.143.10.17 with HTTP; Sun, 12 Aug 2007 22:26:29 -0700 (PDT) Message-ID: <26ddd1750708122226y6107bf8dic16997d14eefd3c8@mail.gmail.com> Date: Mon, 13 Aug 2007 01:26:29 -0400 From: "Maxim Khitrov" To: "illoai@gmail.com" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <26ddd1750708122157n70e6b832p33d378c75c8fd698@mail.gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: ccache never "hits" on buildworld or buildkernel X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2007 05:26:30 -0000 On 8/13/07, illoai@gmail.com wrote: > On 12/08/07, Maxim Khitrov wrote: > > Hello, > > > > I'm using ccache to build FreeBSD source and ports. Ports work great, > > I build something once and the second time just about everything is > > found in the cache. For buildworld and buildkernel, however, > > everything is a miss. Even when not a single thing changed about the > > configuration or the actual source files. > > > > Below is my make.conf configuration for ccache. Ccache is being used > > via world-cc and world-c++ binaries for these two operations; I can > > see the miss counter go up in 'ccache -s'. Why is it unable to > > properly cache when building the source? > > > > Thanks. > > > > make.conf: > > > > .if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && \ > > !defined(NOCCACHE) && exists(/usr/local/libexec/ccache) > > CC= /usr/local/libexec/ccache/world-cc > > CXX=/usr/local/libexec/ccache/world-c++ > > .endif > > > > .if !empty(.CURDIR:M/usr/ports*) && !defined(NOCCACHE) \ > > && exists(/usr/local/libexec/ccache) > > CC= /usr/local/libexec/ccache/cc > > CXX=/usr/local/libexec/ccache/c++ > > .endif > > > > uname -a: > > > > FreeBSD -.-.- 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Sun Aug 12 15:45:05 > > EDT 2007 max@-.-.-:/usr/obj/usr/src/sys/KERNEL i386 > > I believe ccache checks the compiler itself before issuing > a "hit". Since the buildworld process rebuilds the compiler > ccache thinks it's a different compiler and issues a "miss". > > From man ccache: > > CCACHE_NOHASH_SIZE_MTIME > This tells ccache to not hash the real compiler's size and modi- > fication time. Normally this is the mechanism to detect compiler > upgrades. There are situations however, where even though the > compiler's size or modification time has changed you can safely > use the cached objects (e.g. if as part of your build system the > compiler is built as well and the compiler's source has not > changed; or if the compiler has only changes that do not affect > code generation). Use this feature only if you know what you are > doing. > > I hope this helps? Ah... good point, I did not consider this. Indeed setting that environment variable cut the kernel compile time from 30 minutes to 8 with only 2 misses. Now I just have to remember to disable this whenever the compiler actually does change. Wish there was a way to have installworld only copy the compiler over if it is actually different. Oh well, thank you for the tip. - Max