279a3
![]() |
|
|
|
|
|||||||
| Howtos & FAQs (Moderated) Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
install ccache port or add a package:
Code:
# cd /usr/ports/devel/ccache && make install clean # pkg_add -r ccache Code:
.if !defined(NO_CCACHE)
CC= /usr/local/libexec/ccache/world-cc
CXX= /usr/local/libexec/ccache/world-c++
.endif
.if ${.CURDIR:M*/ports/devel/ccache}
NO_CCACHE= yes
.endif
Code:
# set ccache varibles setenv PATH /usr/local/libexec/ccache:$PATH setenv CCACHE_PATH /usr/bin:/usr/local/bin setenv CCACHE_DIR /var/tmp/ccache setenv CCACHE_LOGFILE /var/log/ccache.log # set ccache temp size to 512MB (default 1GB) if ( -x /usr/local/bin/ccache ) then /usr/local/bin/ccache -M 512m > /dev/null endif ccache can be shared between several computers the same as ports tree for example, check man ccache for more info. ADDED 2007.2.15: example ccache stats from my box. Code:
% ccache -s cache directory /var/tmp/ccache cache hit 18562 cache miss 102820 called for link 9824 multiple source files 75 compile failed 1610 preprocessor error 1446 not a C/C++ file 3747 autoconf compile/link 16982 unsupported compiler option 511 no input file 6698 files in cache 49631 cache size 464.3 Mbytes max cache size 512.0 Mbytes comparasion of buildworld times with and without ccache: Code:
# without ccache make -j1 buildworld 4148.38s user 937.02s system 97% cpu 1:27:00.40 total # with ccache make -j1 buildworld 1043.30s user 703.76s system 88% cpu 32:50.02 total Code:
% cd /home/${USER}
% rm -rf .ccache
% ln -s /var/tmp/ccache .ccache
% ls -l .ccache
lrwxr-xr-x 1 ${USER} ${USER} 15 Dec 19 15:20 .ccache -> /var/tmp/ccache
% ccache -s
cache directory /var/tmp/ccache
cache hit 165292
cache miss 327142
called for link 38002
multiple source files 216
compile failed 5182
preprocessor error 4934
couldn't find the compiler 1
not a C/C++ file 26249
autoconf compile/link 52665
unsupported compiler option 1379
no input file 23289
files in cache 79438
cache size 530.2 Mbytes
max cache size 512.0 Mbytes
% sudo ccache -s
cache directory /home/vermaden/.ccache
cache hit 165292
cache miss 327142
called for link 38002
multiple source files 216
compile failed 5182
preprocessor error 4934
couldn't find the compiler 1
not a C/C++ file 26249
autoconf compile/link 52665
unsupported compiler option 1379
no input file 23289
files in cache 79438
cache size 530.2 Mbytes
max cache size 512.0 Mbytes
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com Last edited by vermaden; April 12th, 2010 at 22:49. |
| The Following 18 Users Say Thank You to vermaden For This Useful Post: | ||
Alt (August 28th, 2009), Artefact2 (July 27th, 2009), ckeeper (May 6th, 2011), ckester (March 23rd, 2010), dennylin93 (July 27th, 2009), fraenki (January 7th, 2009), gnemmi (September 19th, 2009), graudeejs (April 23rd, 2009), leoandru (November 2nd, 2009), miggir (May 21st, 2013), nakal (November 25th, 2008), rbelk (February 12th, 2009), smooth (January 28th, 2009), troberts (August 18th, 2009), tuck (January 14th, 2009), Weaseal (January 2nd, 2009), z0ran (December 22nd, 2008), zeissoctopus (August 31st, 2012) | ||
|
#2
|
||||
|
||||
|
<shameless advertising>
I'm using buildflags from sysutils/bsdadminscripts to do that. It also deals with using both, ccache and distcc at the same time. </shameless advertising> I have come to the conclusion that the default cache size of 1GB is way too low. At the moment I'm using 4GB: Code:
# ccache -s cache directory /root/.ccache cache hit 607814 cache miss 993734 called for link 76913 multiple source files 316 compile failed 11642 preprocessor error 7718 couldn't find the compiler 4 not a C/C++ file 90356 autoconf compile/link 97184 unsupported compiler option 14339 no input file 29725 files in cache 269281 cache size 3.6 Gbytes max cache size 4.0 Gbytes |
|
#3
|
||||
|
||||
|
Quote:
Code:
cache hit 165292 cache miss 327142
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#4
|
||||
|
||||
|
More than 30% is very decent. Compiling OpenOffice would blow your cache apart, though. Everything useful would be flushed out. OpenOffice is the reason I stepped from 1GB to 4GB.
|
|
#5
|
||||
|
||||
|
Compiling OpenOffice is like suicide, I always use packages for such big blobs like that
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com Last edited by vermaden; November 17th, 2008 at 10:24. |
|
#6
|
||||
|
||||
|
You normally have to wait for a long time for new OOo packages. That's why I build them myself and share them.
|
|
#7
|
||||
|
||||
|
Propably I do not use OpenOffice that much to care about newest version, current 2.4 version seems to work fine.
Where do you keep your builds mate? Maybe I will try them some day.
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#8
|
||||
|
||||
|
http://wiki.bsdforen.de/anwendungen/...iellen_paketen
I've switched over to 3, because it doesn't have the font rendering problems of the 2-branch. |
|
#9
|
|||
|
|||
|
Is there an ad-hoc way to disable CCACHE? For example, something like:
Code:
make install clean WITHOUT_CCACHE=yes |
|
#10
|
||||
|
||||
|
like that mate:
# make NO_CACHE=yes install clean
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#11
|
|||
|
|||
|
change
Quote:
Code:
.if !defined(NO_CACHE)
CC= /usr/local/libexec/ccache/world-cc
CCX= /usr/local/libexec/ccache/world-c++
.endif
.if ${.CURDIR:M*/ports/devel/ccache}
NO_CCACHE= yes
.endif
|
| The Following User Says Thank You to kegf For This Useful Post: | ||
smooth (January 28th, 2009) | ||
|
#12
|
||||
|
||||
|
@kegf
Thanks.
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#13
|
|||
|
|||
|
Add a note:
You have to reinstall devel/libtool15 if it's installed, as changing CC/CXX will screw things up for it. Adding the PATH change is not required and can create problems with lang/gcc* ports as dependencies, as it will add gcc## to $PATH and BUILD_DEPENDS will think it's installed, but once compilation starts it doesn't work. I use: :setenv=....<stripped other stuff>,CCACHE_DIR=/var/db/ccache/$: in /etc/login.conf to make CCACHE_DIR independant of shell semantics and dot.profile files. Finally the stats from my package builder: Code:
cache directory /var/db/ccache/root cache hit 508615 cache miss 379447 called for link 66381 multiple source files 228 compile failed 13214 ccache internal error 2 preprocessor error 21943 not a C/C++ file 27067 autoconf compile/link 118453 unsupported compiler option 6337 no input file 38147 files in cache 650587 cache size 8.6 Gbytes max cache size 10.0 Gbytes Last edited by Mel_Flynn; February 13th, 2009 at 21:31. Reason: smilies code bleh |
| The Following User Says Thank You to Mel_Flynn For This Useful Post: | ||
graudeejs (April 23rd, 2009) | ||
|
#14
|
|||
|
|||
|
A small question. It is CCX or CXX? In /usr/local/share/doc/ccache/ccache-howto-freebsd.txt, is's CXX.
|
|
#15
|
||||
|
||||
|
Its CXX.
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#16
|
||||
|
||||
|
Thanks for this tip.
A little precision : if you use a non-csh shell, you have to edit the rc file of your shell, not /.cshrc. The syntax might change (export instead of setenv, ...). |
|
#17
|
||||
|
||||
|
@Artefact2
That's obvious, but thanks for pointing it out.
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#18
|
||||
|
||||
|
My Stats:
I build OpenOffice.org-3.1 uncached (with ccache on) in about 10-11 hours It took about 3h 40min to compile OOO3.1 when it was cached in ccache ![]() My PC: Pentium 4 HTT @ 3GHz RAM: 2.5GB @ 400Mhz on GELI encrypted zpool ![]() Code:
killasmurf86 $ ccache -s cache directory /var/db/ccache cache hit 79143 cache miss 139100 called for link 14059 multiple source files 75 compile failed 3599 ccache internal error 1 preprocessor error 2494 couldn't find the compiler 2 not a C/C++ file 7095 autoconf compile/link 28680 unsupported compiler option 932 no input file 10850 files in cache 278200 cache size 2.6 Gbytes max cache size 4.0 Gbytes Last edited by graudeejs; August 23rd, 2009 at 07:29. |
|
#19
|
|||
|
|||
|
Code:
# Allow CCACHE for PORTS only (the buildworld has error with CCACHE)
.if ${.CURDIR:M*/ports*}
.if exists(/usr/local/libexec/ccache/world-cc) && !defined(NO_CCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif
CFLAGS= ...
CXXFLAGS=${CFLAGS}
...
...
.endif
Last edited by nal; September 27th, 2009 at 03:34. |
|
#20
|
||||
|
||||
|
A lots of luniz here will just copy-paste it and hit a wall:
Code:
.if !defined(NO_CACHE)
CC= /usr/local/libexec/ccache/world-cc
CXX= /usr/local/libexec/ccache/world-c++
.endif
.if ${.CURDIR:M*/ports/devel/ccache}
NO_CCACHE= yes
.endif
|
|
#21
|
||||
|
||||
|
@Seeker
Thanks, its also funny how long it was here without notifying
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#22
|
||||
|
||||
|
my apace of /var is limit and I use this command
Code:
portmaster -D -r -w gettext Code:
/var |
|
#23
|
|||
|
|||
|
Simply limit the size of your cache using
# ccache -MIf you delete the files, your cache will be empty. |
|
#24
|
|||
|
|||
|
I'm wondering how I would go about using a new version of gcc (gcc45) with ccache. Right now I have just gcc45 running per the instructions at: http://www.freebsd.org/doc/en/articl...c/article.html
That works fine but how would I go about getting ccache to use that. It seems like the instructions are for the standard version of gcc that comes with FreeBSD. My current /etc/make.conf Code:
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc45) CC=gcc45 CXX=g++45 CPP=cpp45 CPUTYPE?=amd64 .endif Code:
libgcc_s.so.1 gcc45/libgcc_s.so.1 libgomp.so.1 gcc45/libgomp.so.1 libobjc.so.3 gcc45/libobjc.so.2 libssp.so.0 gcc45/libssp.so.0 libstdc++.so.6 gcc45/libstdc++.so.6 |
|
#25
|
||||
|
||||
|
Using e.g. USE_GCC= 4.5+ is sufficient to my understanding.
According to http://ftp2.pl.freebsd.org/pub/FreeB.../Mk/bsd.gcc.mk
__________________
What was the goal of the Linux community--to replace Windows? One can imagine higher aspirations., Bill Joy |
![]() |
| Tags |
| ccache, kiss |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HOWTO: FreeBSD CPU Scaling and Power Saving | vermaden | Howtos & FAQs (Moderated) | 47 | December 30th, 2011 15:25 |