Bug 272917 - Both devel/ccache3 and devel/ccache4 cannot set up symbolic links properly, including ccache-update-links.
Summary: Both devel/ccache3 and devel/ccache4 cannot set up symbolic links properly, i...
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Some People
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-03 13:33 UTC by ykla
Modified: 2024-09-19 18:11 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (bdrewery)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ykla 2023-08-03 13:33:37 UTC
In the default configuration, when compiling ccache, it fails to generate the symbolic links for clang, and similar compilers correctly. Using ccache-update-links also has no effect, and there is no output.

The same result occurs when installing via pkg.
--------------------------

[1/3] Installing liblz4-1.9.4,1...
[1/3] Extracting liblz4-1.9.4,1: 100%
[2/3] Installing zstd-1.5.5...
[2/3] Extracting zstd-1.5.5: 100%
[3/3] Installing ccache4-4.8...
[3/3] Extracting ccache4-4.8: 100%
Create compiler links...
create symlink for cc
create symlink for cc (world)
create symlink for c++
create symlink for c++ (world)
create symlink for CC
create symlink for CC (world)
create symlink for clang
create symlink for clang (world)
create symlink for clang++
create symlink for clang++ (world)
root@ykla:/usr/ports/devel/ccache4 # which clang
/usr/bin/clang
root@ykla:/usr/ports/devel/ccache4 # ccache-update-links
root@ykla:/usr/ports/devel/ccache4 # which clang
/usr/bin/clang
root@ykla:/usr/ports/devel/ccache4 # which cc
/usr/bin/cc
root@ykla:/usr/ports/devel/ccache4 # ls -al /usr/bin/cc
-r-xr-xr-x  6 root wheel 109032752 Jul 27 00:01 /usr/bin/cc
-----------------------------
Comment 1 ykla 2023-08-03 13:34:43 UTC
root@ykla:/usr/ports/devel/ccache4 # uname -a
FreeBSD ykla 14.0-CURRENT FreeBSD 14.0-CURRENT aarch64 1400093 main-232b922cb3 GENERIC arm64

root@ykla:/usr/ports/devel/ccache4 # pkg info ccache4
ccache4-4.8
Name           : ccache4
Version        : 4.8
Installed on   : Thu Aug  3 21:31:00 2023 CST
Origin         : devel/ccache4
Architecture   : FreeBSD:14:aarch64
Prefix         : /usr/local
Categories     : devel
Licenses       : GPLv3+
Maintainer     : bdrewery@FreeBSD.org
WWW            : https://ccache.dev/
Comment        : Tool to minimize the compile time of C/C++ programs
Options        :
	CLANGLINK      : on
	DOCS           : on
	LLVMLINK       : on
	STATIC         : off
	TEST           : off
Shared Libs required:
	libzstd.so.1
Annotations    :
	FreeBSD_version: 1400093
	repo_type      : binary
	repository     : ustc
Flat size      : 1.86MiB
Description    :
ccache is a compiler cache.  It acts as a caching pre-processor to C/C++
compilers, using the -E compiler switch and a hash to detect when a
compilation can be satisfied from cache.  This often results in a 5 to 10
times speedup in common compilations.

WWW: https://ccache.dev/
root@ykla:/usr/ports/devel/ccache4 #
Comment 2 Oleg Sidorkin 2024-09-19 13:22:25 UTC
It puts links under /usr/local/libexec/ccache

Then there's some code in bsd.ccache.mk that prepends /usr/local/libexec/ccache to $PATH so port uses ccache wrappers to compile its code.
Comment 3 ykla 2024-09-19 18:11:10 UTC
Yes, thanks.

-----------------

root@ykla:/usr/ports/www/chromium # ls -al  /usr/local/libexec/ccache
total 56
drwxr-xr-x   3 root wheel 15 Sep 20 02:02 .
drwxr-xr-x  18 root wheel 49 Sep 20 01:39 ..
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 CC -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 c++ -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 cc -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 clang -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 clang++ -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 clang++15 -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 02:02 clang++18 -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 clang15 -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 02:02 clang18 -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 cpp13 -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 g++13 -> /usr/local/bin/ccache
lrwxr-xr-x   1 root wheel 21 Sep 20 00:29 gcc13 -> /usr/local/bin/ccache
drwxr-xr-x   2 root wheel 15 Sep 20 02:02 world
------


By set WITH_CCACHE_BUILD=yes in /make/conf. I can see ccache -s:

-----------
root@ykla:~ # ccache -s
cache directory                     /root/.ccache
primary config                      /root/.ccache/ccache.conf
secondary config      (readonly)    /usr/local/etc/ccache.conf
stats updated                       Fri Sep 20 02:05:35 2024
cache hit (direct)                    20
cache hit (preprocessed)              17
cache miss                           918
cache hit rate                      3.87 %
called for link                      121
called for preprocessing              26
compile failed                       115
preprocessor error                    66
bad compiler arguments                15
autoconf compile/link                523
no input file                         71
cleanups performed                     0
files in cache                      2305
cache size                           0.0 kB
max cache size                      10.0 GB
--------------