diff --git a/env.sh b/env.sh index c952e82281..171a868468 100755 --- a/env.sh +++ b/env.sh @@ -161,8 +161,18 @@ if [[ -z "${DORIS_BIN_UTILS}" ]]; then export DORIS_BIN_UTILS='/usr/bin/' fi +if [[ -z "${DORIS_GCC_HOME}" ]]; then + DORIS_GCC_HOME="$(dirname "$(which gcc)")/.." + export DORIS_GCC_HOME +fi + +if [[ ! -f "${DORIS_GCC_HOME}/bin/gcc" ]]; then + echo "Error: wrong directory DORIS_GCC_HOME=${DORIS_GCC_HOME}" + exit 1 +fi + # export CLANG COMPATIBLE FLAGS -CLANG_COMPATIBLE_FLAGS="$(echo | "${DORIS_GCC_HOME:-"$(dirname "$(which gcc)")/.."}/bin/gcc" -Wp,-v -xc++ - -fsyntax-only 2>&1 | +CLANG_COMPATIBLE_FLAGS="$(echo | "${DORIS_GCC_HOME}/bin/gcc" -Wp,-v -xc++ - -fsyntax-only 2>&1 | grep -E '^\s+/' | awk '{print "-I" $1}' | tr '\n' ' ')" export CLANG_COMPATIBLE_FLAGS