Copilot commented on code in PR #61591:
URL: https://github.com/apache/doris/pull/61591#discussion_r2969012847


##########
env.sh:
##########
@@ -146,12 +153,24 @@ if [[ "${DORIS_TOOLCHAIN}" == "gcc" ]]; then
 elif [[ "${DORIS_TOOLCHAIN}" == "clang" ]]; then
     # set CLANG HOME
     if [[ -z "${DORIS_CLANG_HOME}" ]]; then
-        DORIS_CLANG_HOME="$(dirname "$(command -v clang)")"/..
+        BREW_LLVM_PREFIX="$(brew --prefix llvm 2>/dev/null || true)"
+        if [[ -n "${BREW_LLVM_PREFIX}" && -x "${BREW_LLVM_PREFIX}/bin/clang++" 
]]; then
+            DORIS_CLANG_HOME="${BREW_LLVM_PREFIX}"
+        else
+            DORIS_CLANG_HOME="$(dirname "$(command -v clang)")"/..
+        fi

Review Comment:
   `DORIS_CLANG_HOME` is now preferred from `brew --prefix llvm`, but the mac 
toolchain setup earlier configures `llvm@20` in `custom_env_mac.sh`. If both 
formulas exist, this can select a different LLVM than the one put on PATH (or 
fail to find the intended version), leading to mismatched compiler/toolchain 
behavior. It would be more consistent to query the same formula/version 
(`llvm@20`) or derive `DORIS_CLANG_HOME` purely from the resolved `clang` in 
PATH.



##########
env.sh:
##########
@@ -20,6 +20,13 @@
 # check DORIS_HOME
 export LC_ALL=C
 
+# unset Homebrew compile env(include/lib path) to avoid conflict
+unset CPATH
+unset C_INCLUDE_PATH
+unset CPLUS_INCLUDE_PATH
+unset CPPFLAGS
+unset LDFLAGS
+

Review Comment:
   The script unsets CPATH/C_INCLUDE_PATH/CPLUS_INCLUDE_PATH/CPPFLAGS/LDFLAGS 
unconditionally, even on Linux. This can unexpectedly break developer 
environments or CI where these variables are intentionally set for non-Homebrew 
toolchains. Consider scoping these unsets to Darwin/Homebrew-only (e.g., behind 
the existing `uname -s == Darwin` check) or preserving/restoring user-provided 
values via prefixed variables.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to