From 88d168f314524b7b494563b66dcbd05c4f1c91fd Mon Sep 17 00:00:00 2001 From: jgautier-dd Date: Thu, 6 Feb 2025 10:58:16 -0800 Subject: [PATCH 1/2] add extra case for ../ --- toolchain/osx_cc_wrapper.sh.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/osx_cc_wrapper.sh.tpl b/toolchain/osx_cc_wrapper.sh.tpl index 31122784b..6b48be56e 100755 --- a/toolchain/osx_cc_wrapper.sh.tpl +++ b/toolchain/osx_cc_wrapper.sh.tpl @@ -57,7 +57,7 @@ function parse_option() { if [[ -f %{toolchain_path_prefix}bin/clang ]]; then execroot_path="" execroot_abs_path="${PWD}/" -elif [[ ${BASH_SOURCE[0]} == "/"* ]]; then +elif [[ ${BASH_SOURCE[0]} == "/"* ]] || [[ ${BASH_SOURCE[0]} == "../"* ]]; then # Some consumers of `CcToolchainConfigInfo` (e.g. `cmake` from rules_foreign_cc) # change CWD and call $CC (this script) with its absolute path. # For cases like this, we'll try to find `clang` through an absolute path. From f7f77a31c16724653a22a11b4f5106d935dd13f0 Mon Sep 17 00:00:00 2001 From: jgautier-dd Date: Fri, 7 Feb 2025 08:01:32 -0800 Subject: [PATCH 2/2] add fix for linux --- toolchain/cc_wrapper.sh.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/cc_wrapper.sh.tpl b/toolchain/cc_wrapper.sh.tpl index e972d57e6..fbba9d74c 100644 --- a/toolchain/cc_wrapper.sh.tpl +++ b/toolchain/cc_wrapper.sh.tpl @@ -34,7 +34,7 @@ set -euo pipefail if [[ -f %{toolchain_path_prefix}bin/clang ]]; then execroot_path="" -elif [[ ${BASH_SOURCE[0]} == "/"* ]]; then +elif [[ ${BASH_SOURCE[0]} == "/"* ]] || [[ ${BASH_SOURCE[0]} == "../"* ]]; then # Some consumers of `CcToolchainConfigInfo` (e.g. `cmake` from rules_foreign_cc) # change CWD and call $CC (this script) with its absolute path. # For cases like this, we'll try to find `clang` through an absolute path.