From 26ad6ed14f64775784679964c9478a8b3aafb135 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 15 Jul 2026 05:07:43 +0200 Subject: [PATCH] Fix using ccache with clang-linux toolset (#605) * Fix using ccache with clang-linux toolset When using ccache with `using clang : : ccache clang++-3.6 ;` then `common.get-absolute-tool-path` fails. Use the last element as done for gcc * Add test for clang-win auto-deducing ar --- src/tools/clang-linux.jam | 2 +- test/toolset-mock/project-config.jam | 2 ++ test/toolset_clang_linux.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/clang-linux.jam b/src/tools/clang-linux.jam index 95e8f8fe7..03f5546c2 100644 --- a/src/tools/clang-linux.jam +++ b/src/tools/clang-linux.jam @@ -110,7 +110,7 @@ rule init ( version ? : command * : options * ) { } if ! $(archiver) { - local bin = [ common.get-absolute-tool-path $(command) ] ; + local bin = [ common.get-absolute-tool-path $(command[-1]) ] ; archiver = [ common.get-invocation-command-nodefault clang-linux : llvm-ar : : $(bin) : search-path ] ; } toolset.flags clang-linux.archive .AR $(condition) : $(archiver[1]) ; diff --git a/test/toolset-mock/project-config.jam b/test/toolset-mock/project-config.jam index ded8d78bd..4d73ec241 100644 --- a/test/toolset-mock/project-config.jam +++ b/test/toolset-mock/project-config.jam @@ -27,6 +27,8 @@ using darwin : 4.2.1 : $(PYTHON) $(here)/src/darwin-4.2.1.py using clang-darwin : 3.9.0 : $(PYTHON) $(here)/src/clang-3.9.0-darwin.py : $(ar) ; using clang-linux : 3.9.0 : $(PYTHON) $(here)/src/clang-linux-3.9.0.py : $(ar) ; +# Let clang-linux auto-deduce the archiver +using clang-linux : 3.9.1 : $(PYTHON) $(here)/src/clang-linux-3.9.0.py ; using clang-vxworks : 4.0.1 : $(PYTHON) $(here)/src/clang-vxworks-4.0.1.py : $(ar) ; using intel-darwin : 10.2 : $(PYTHON) $(here)/src/intel-darwin-10.2.py : $(ar) ; diff --git a/test/toolset_clang_linux.py b/test/toolset_clang_linux.py index 1ff12336e..0f078a85e 100644 --- a/test/toolset_clang_linux.py +++ b/test/toolset_clang_linux.py @@ -27,3 +27,6 @@ test_toolset("clang-linux", "3.9.0", [ ["target-os=windows", "link=static"], ["target-os=windows", "architecture=x86", "address-model=32"] ]) + +# Auto-deduced ar +test_toolset("clang-linux", "3.9.1", [["target-os=linux"]])