Base system src build won't work with devel/ccache look like

Hi All

I had been setup devel/ccache for SRC and ports build at /etc/make.conf and /etc/src.conf as below.
Code:
WITH_CCACHE_BUILD=yes

devel/ccache work fine with ports build but src build won't.

I saw src build make took devel/ccache as below.
Code:
--- MC/MCSchedule.o ---
/usr/local/bin/ccache c++  -O2 -pipe -fno-common -I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm -I/usr/src/contrib/llvm-project/llvm/lib/Target/X86 -I/usr/src/lib/clang/include -I/usr/src
/contrib/llvm-project/llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_VCS_VERSION_INC -DNDEBUG -DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd13.1\" -DLLVM
_HOST_TRIPLE=\"x86_64-unknown-freebsd13.1\" -DDEFAULT_SYSROOT=\"/usr/obj/usr/src/amd64.amd64/tmp\" -DLLVM_TARGET_ENABLE_X86 -DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser -DLLVM_NATIVE_ASMPRINTER=LLV
MInitializeX86AsmPrinter -DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler -DLLVM_NATIVE_TARGET=LLVMInitializeX86Target -DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo -DLLVM_NATIVE_TARGETMC=
LLVMInitializeX86TargetMC -ffunction-sections -fdata-sections -gline-tables-only -MD -MF.depend.MC_MCSchedule.o -MTMC/MCSchedule.o -Wno-format-zero-length -Wno-empty-body -Wno-string-plus-int -Wno-unused
-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-sw
itch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include  -fno-exceptions -fno-rtti -gline-tables-only -std=c++14    -stdlib=libc++
-Wno-c++11-extensions   -c /usr/src/contrib/llvm-project/llvm/lib/MC/MCSchedule.cpp -o MC/MCSchedule.o
And devel/ccache handled as below.
Code:
  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
   94 root          1  79    0   203M   161M CPU1     1   0:03  59.79% c++
   83 root          1  52    0    13M  3112K wait     1   0:00  13.78% ccache
32948 root          1  52    0    19M  6940K wait     0   0:00  10.81% ccache
83809 root          1  52    0    19M  6308K wait     1   0:00   1.61% ccache

But statistics counters of devel/ccache have never update, check by ccache -s.
Can help/hint for the issue?

Thanks very much.
 
You could try to clean the ccache directory i.e. rm -vfR 1 2 3 4 5 6 ...
It would help if you show the error you get.
It would help if you show your complete kernel-config-file ,src.conf , make.conf
 
Did you set CCACHE_DIR? If not, is there anything in $HOME/.ccache?
Yes, I had been set CCACHE_DIR in /usr/local/etc/ccache.confas below
Code:
cache_dir = /var/cache/ccache
cache_dir_levels = 4
hash_dir = true
max_size = 16.0G

Thanks a lot.
 
Yes, I had been set CCACHE_DIR in /usr/local/etc/ccache.confas below
Code:
cache_dir = /var/cache/ccache
cache_dir_levels = 4
hash_dir = true
max_size = 16.0G

Thanks a lot.
Are there any files in /var/cache/ccache? What does ccache -p output?
 
Are there any files in /var/cache/ccache? What does ccache -p output?
  • Much of files in /var/cache/ccache.
    Only ports build can be add files into here, src build not.
  • Output of ccache -p as below.
    Code:
    (default) base_dir =(/usr/local/etc/ccache.conf) cache_dir = /var/cache/ccache
    (/usr/local/etc/ccache.conf) cache_dir_levels = 4
    (default) compiler =
    (default) compiler_check = mtime
    (default) compression = false
    (default) compression_level = 6
    (default) cpp_extension =
    (default) debug = false
    (default) depend_mode = false
    (default) direct_mode = true
    (default) disable = false
    (default) extra_files_to_hash =
    (default) hard_link = false
    (/usr/local/etc/ccache.conf) hash_dir = true
    (default) ignore_headers_in_manifest =
    (default) keep_comments_cpp = false
    (default) limit_multiple = 0.8
    (default) log_file =
    (default) max_files = 0
    (/var/cache/ccache/ccache.conf) max_size = 16.0G
    (environment) path = /usr/bin:/usr/local/bin
    (default) pch_external_checksum = false
    (default) prefix_command =
    (default) prefix_command_cpp =
    (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 =

Thanks a lot.
 
The src.conf(5) man page says
The default cache directory of $HOME/.ccache will be used, which can be overridden by setting CCACHE_DIR.

I'm guessing you have a bunch of files in $HOME/.ccache too. You could export CCACHE_DIR=/var/cache/ccache before running your build, or get build stats with ccache -o cache_dir=$HOME/.ccache -s.
 
You could try to clean the ccache directory i.e. rm -vfR 1 2 3 4 5 6 ...
It would help if you show the error you get.
It would help if you show your complete kernel-config-file ,src.conf , make.conf
  • ccache directory removed and src build, have no any file/directory add into ccache directory.
  • About make.conf as below. (Line of comment out removed)
    Code:
    CPUTYPE?=native
    MACHINE_CPU+=sse42 sse41
    NO_ATM=         true    # do not build ATM related programs and librariesNO_BLUETOOTH=   true    # do not build Bluetooth related stuff
    NO_CVS=         true    # do not build CVS
    NO_DICT=        true    # do not build the Webster dictionary files
    NO_FORTRAN=     true    # do not build g77 and related libraries
    NO_GAMES=       true    # do not build games (games/ subdir)
    NO_GPIB=        true    # do not build GPIB support
    NO_I4B=         true    # do not build isdn4bsd package
    NO_IPFILTER=    true    # do not build IP Filter package
    NO_NETCAT=      true    # do not build netcat
    NO_NIS=         true    # do not build NIS support and related programs.
    NO_NLS_CATALOGS=        # do not build NLS catalog support for csh(1)
    NO_OPENSSH=     true    # do not build OpenSSH
    NO_RCMDS=       true    # do not build or install BSD r* commands (rsh, etc).
    NO_SHAREDOCS=           # do not build the 4.4BSD legacy docs
    NO_BIND=        true    # Do not build any part of BIND
    KERNCONF=       MYKernel
    MASTER_SITE_BACKUP?=    \
    ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
    MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}
    OPTIONS_SET+=ZTS
    OPTIONS_UNSET+=DOCS
    ${OPTIONS_NAME}_SET+=MOUSE KEYBOARD INTEL VESA
    ${OPTIONS_NAME}_UNSET+=ATI MACH64 NV R128 RADEONHD OPENCHROME ACECAD ELOGRAPHICS
    DEFAULT_VERSIONS+=ssl=openssl
    CCACHE_DIR="/var/cache/ccache"
    WITH_CCACHE_BUILD=yes
  • About src.conf as below. (Line of comment out removed)
    Code:
    WITHOUT_AMD=yesWITHOUT_APM=yes
    WITHOUT_ATM=yes
    WITHOUT_BIND=yes
    WITHOUT_BIND_DNSSEC=yes
    WITHOUT_BIND_ETC=yes
    WITHOUT_BIND_LIBS_LWRES=yes
    WITHOUT_BIND_MTREE=yes
    WITHOUT_BIND_NAMED=yes
    WITHOUT_BIND_UTILS=yes
    WITHOUT_BLUETOOTH=yes
    WITH_CCACHE_BUILD=yes
    WITH_CLANG=yes
    WITH_CLANG_EXTRAS=yes
    WITH_CLANG_FULL=yes
    WITH_CLANG_IS_CC=yes
    WITH_CTF=yes
    WITHOUT_CVS=yes
    WITHOUT_DICT=yes
    WITHOUT_FDT=yes
    WITHOUT_FLOPPY=yes
    WITHOUT_GAMES=yes
    WITHOUT_GPIB=yes
    WITHOUT_GSSAPI=yes
    WITH_ICONV=yes
    WITH_IDEA=yes
    WITHOUT_IPFILTER=yes
    WITHOUT_IPFW=yes
    WITHOUT_IPX=yes
    WITHOUT_IPX_SUPPORT=yes
    WITHOUT_KERBEROS=yes
    WITHOUT_KERBEROS_SUPPORT=yes
    WITHOUT_KERNEL_SYMBOLS=yes
    WITHOUT_LEGACY_CONSOLE=yes
    WITH_LIBCPLUSPLUS=yes
    WITH_LIBICONV_COMPAT=yes
    WITHOUT_LPR=yes
    WITHOUT_NCP=yes
    WITHOUT_NDIS=yes
    WITHOUT_NIS=yes
    WITHOUT_OPENSSH=yes
    WITHOUT_PKGTOOLS=yes
    WITHOUT_PPP=yes
    WITHOUT_RCMDS=yes
    WITHOUT_RCS=yes
    WITHOUT_SHAREDOCS=yes
    WITH_SHARED_TOOLCHAIN=yes
    WITHOUT_SVNLITE=yes
    WITHOUT_TELNET=yes
    WITHOUT_WIRELESS=yes
    WITHOUT_WIRELESS_SUPPORT=yes
    WITHOUT_WPA_SUPPLICANT_EAPOL=yes
Thanks you a lot.
 
The src.conf(5) man page says


I'm guessing you have a bunch of files in $HOME/.ccache too. You could export CCACHE_DIR=/var/cache/ccache before running your build, or get build stats with ccache -o cache_dir=$HOME/.ccache -s.
  • In my case, src build as root, therefore I checked /root/.ccache, result: not exist.
  • Tried to set as setenv CCACHE_DIR /var/cache/ccache @ csh, result: not work (ccache -s won't update and /var/cache/ccache won't add any files).
  • About # ccache -o cache_dir=$HOME/.ccache -s, result as below.
    Code:
    cache directory                     /root/.ccache
    primary config                      /var/cache/ccache/ccache.conf
    secondary config      (readonly)    /usr/local/etc/ccache.conf
    cache hit (direct)                     0
    cache hit (preprocessed)               0
    cache miss                             0
    cache hit rate                      0.00 %
    cleanups performed                     0
    files in cache                         0
    cache size                           0.0 kB
    max cache size                      16.0 GB
    PS: All zero because cleaned the ccache directory /var/cache/ccache and cleared statistics counters before.

    Directory /root/.ccache created and src build.
    Result: Statistics counters zero still and no any files add into /root/.ccache.

Thanks you a lot.
 
If you want to reduce FreeBSD source build time, besides devel/ccache, you can use the MetaMode build system instead.

The first time build with META_MODE will take some time, but following builds will have a considerable shorter build time.

To load the "filemon" kernel module automatically on reboot, set in /etc/rc.conf
Code:
kld_list="filemon"
 
If you want to reduce FreeBSD source build time, besides devel/ccache, you can use the MetaMode build system instead.

The first time build with META_MODE will take some time, but following builds will have a considerable shorter build time.

To load the "filemon" kernel module automatically on reboot, set in /etc/rc.conf
Code:
kld_list="filemon"
I will study it.

Thanks you a lot.
 
Back
Top