Solved CCACHE problem

Synth is annoying me.
I don't like devel/ccache on amd64 but it seems I have to work with ccache(1).

Follow this recipe:
https://forums.freebsd.org/threads/howto-freebsd-with-ccache.174/

but:
Code:
cache directory  /var/tmp/ccache
primary config  /var/tmp/ccache/ccache.conf
secondary config  (readonly)  /usr/local/etc/ccache.conf
cache hit (direct)  0
cache hit (preprocessed)  0
cache miss  0
files in cache  0
cache size  0.0 kB
max cache size  5.0 GB

It is longer time ago, I worked with it, I forgot the how. Does it need an entry in /etc/rc.conf ?
 
You need to configure it, read the man page (or just execute ccache and read the help screen)

The title of this post is antagonistic. Obviously ccache(1) works. I guess you mean, "it doesn't work for me" but that's not how one would interpret this. At least allow for user error because it sounds like you think all the software is just broken when it doesn't do what you expect.
 
Finally, what you show as output is usable. Maybe it's not configured how you like, but you could use that.
 
It is only a title.

at boot:
Code:
Can't create /var/tmp/ccache/ccache.conf.tmp.XXXXXX permission denied

Code:
ls -al /var/tmp/ccache
drwxrwxr-x  2 root  wheel  512 30 Jan 16:40 ccache

Has it an own group? I don't remember or can't find anything about it.
 
I installed devel/ccache just recently but I no not remember any issues. I kept almost everything default. Just the cache size is 5G now. By the way, every user can have a different configuration. ccache -p shows the configuration for the current user. The error message might show that you do not run devel/ccache as root. Can this be the problem?
 
The permission problem is solved , overlooked something in /etc/fstab.
But ccache seems nothing to do.
Code:
 ccache -p
(default) base_dir =
(environment) cache_dir = /var/tmp/ccache
(default) cache_dir_levels = 2
(default) compiler =
(default) compiler_check = mtime
(default) compression = false
(default) compression_level = 6
(default) cpp_extension =
(default) direct_mode = true
(default) disable = false
(default) extra_files_to_hash =
(default) hard_link = false
(default) hash_dir = false
(environment) log_file = /var/log/ccache.log
(default) max_files = 0
(/var/tmp/ccache/ccache.conf) max_size = 8.2G
(environment) path = /usr/bin:/usr/local/bin
(default) prefix_command =
(default) read_only = false
(default) read_only_direct = false
(default) recache = false
(default) run_second_cpp = true
(default) sloppiness =
(default) stats = true
(default) temporary_dir =
(default) umask =
(default) unify = false

I leave all on defaults (except the size).

If cache -s is not the correct command to look if it works, what is it. Only the buildtime?. As far I remember it was ccache -s.
 
Got it to work (removed all and make it new - but don't know where the error was).
Left only the question how to tell synth work with it.
man synth:
Code:
Compiler cache directory  If ccache is properly installed on the system,
  set this value to the location of the cache.

Whatever I put in:
Code:
make: "/xports/Mk/Uses/compiler.mk" line 69: warning: "/usr/local/libexec/ccache/world/cc --version" returned non-zero status
make: "/xports/Mk/Uses/compiler.mk" line 120: warning: "/usr/local/libexec/ccache/world/c++ -### /dev/null 2>&1" returned non-zero status
 
Thanks! I have found it just before. But now it seems it not faster as without, but I want test a few packages more. I see in ps that ccache(1) runs, but if it does the right, I can't say.
 
I've built thousands of ports with ccache(1). It always works.
I'm guessing many of the other synth users are utilizing ccache(1) as well. Nobody is complaining about it (other than you of course)
 
It is horrible, synth(1) only work one times with ccache(1). I changed nothing, after next reboot, it works no more with ccache(1). In the ports it works.
I'm guessing from reading your posts above you possibly have your system set to delete files and folders in the /tmp directory when rebooting. That would of course delete the cache as well. Set your cache directory to another directory so it doesn't get deleted on reboot if this is the case or make sure /tmp isn't cleared on reboot.

Again, this is purely a guess on my part as I have no idea what you've done or how you've set up/altered your system.
 
There is not much to configure, and not much what I could do wrong.
Code:
[Global Configuration]
profile_selected= LiveSystem

[LiveSystem]
Operating_system= FreeBSD
Directory_packages= /var/synth/live_packages
Directory_repository= /var/synth/live_packages/All
Directory_portsdir= /usr/ports
Directory_options= /var/db/ports
Directory_distfiles= /usr/ports/distfiles
Directory_buildbase= /usr/obj/synth-live
Directory_logs= /var/log/synth
Directory_ccache= /ram
Directory_system= /
Number_of_builders= 2
Max_jobs_per_builder= 3
Tmpfs_workdir= true
Tmpfs_localbase= true
Display_with_ncurses= true
leverage_prebuilt= false
 
There is the crux:

Code:
WITH_CCACHE_BUILD=yes
WRKDIRPREFIX=/ram

.if !defined(NO_CCACHE)
#  CC=/usr/local/libexec/ccache/world/cc
#  CXX=/usr/local/libexec/ccache/world/c++
.endif

I commented out, cause of the above error messages. But the two lines can't be wrong.
 
No error messages (but it was a valid statement, althrough the comments).

Code:
cache directory  /ram
primary config  /ram/ccache.conf
secondary config  (readonly)  /usr/local/etc/ccache.conf
cache hit (direct)  43
cache hit (preprocessed)  95
cache miss  98
called for link  6
called for preprocessing  24
compile failed  20
preprocessor error  60
bad compiler arguments  2
autoconf compile/link  302
no input file  70
files in cache  137
cache size  651.3 kB
max cache size  5.0 GB

But nothing in ps.
 
Code:
mount|grep ram
tmpfs on /ram (tmpfs, local)
/ram on /usr/obj/synth-live/SL01/ccache (nullfs, local)
 
Your defeating the purpose of ccache(1) by putting the cache directory in a tmpfs(5) mount. /ram is unmounted on each reboot, essentially deleting the cache directory. No wonder it isn't working. The cache directory for ccache(1) needs to be on disk so it's persistent.

Do the following, assuming your the only user of the machine:
  1. # echo "cache_dir = /var/cache/ccache" >> /usr/local/etc/ccache.conf
  2. # echo "max_size = 10G" >> /usr/local/etc/ccache.conf
This will set your cache directory for ccache(1) to /var/cache/ccache and set the cache size to a maximum of 10GB.
 
Back
Top