diff --git a/src/backend/booster/bk_dist/controller/pkg/manager/basic/utils.go b/src/backend/booster/bk_dist/controller/pkg/manager/basic/utils.go index e7640bd3..0fb45e9d 100644 --- a/src/backend/booster/bk_dist/controller/pkg/manager/basic/utils.go +++ b/src/backend/booster/bk_dist/controller/pkg/manager/basic/utils.go @@ -220,11 +220,13 @@ func searchToolChain(cmd string) (*types.ToolChain, error) { blog.Infof("basic: real start search toolchian for cmd:%s", cmd) defer blog.Infof("basic: end search toolchian for cmd:%s", cmd) - if strings.HasSuffix(cmd, "clang") || strings.HasSuffix(cmd, "clang++") { + cmdbase := filepath.Base(cmd) + switch cmdbase { + case "clang", "clang++": return searchClang(cmd) - } - - if strings.HasSuffix(cmd, "gcc") || strings.HasSuffix(cmd, "g++") { + case "gcc", "g++": + return searchGcc(cmd) + case "cc", "c++": return searchGcc(cmd) } diff --git a/src/backend/booster/bk_dist/handler/cc/handler.go b/src/backend/booster/bk_dist/handler/cc/handler.go index 56a06bd2..1b36301d 100644 --- a/src/backend/booster/bk_dist/handler/cc/handler.go +++ b/src/backend/booster/bk_dist/handler/cc/handler.go @@ -1158,7 +1158,7 @@ func (cc *TaskCC) preBuild(args []string) error { } // strip the args and get the server side args. - serverSideArgs := stripLocalArgs(finalArgs) + serverSideArgs := stripLocalArgs(finalArgs, cc.sandbox.Env) if cc.supportDirectives { serverSideArgs = append(serverSideArgs, "-fdirectives-only") } diff --git a/src/backend/booster/bk_dist/handler/cc/utils.go b/src/backend/booster/bk_dist/handler/cc/utils.go index f49f78af..ff40a849 100644 --- a/src/backend/booster/bk_dist/handler/cc/utils.go +++ b/src/backend/booster/bk_dist/handler/cc/utils.go @@ -516,7 +516,7 @@ func getPreprocessedExt(inputFile string) string { // are pointed to by that array are aliased with the values pointed // to by 'from'. The caller is responsible for calling free() on // '*out_argv'. -func stripLocalArgs(args []string) []string { +func stripLocalArgs(args []string, env *env.Sandbox) []string { r := make([]string, 0, len(args)) // skip through argv, copying all arguments but skipping ones that ought to be omitted @@ -549,7 +549,9 @@ func stripLocalArgs(args []string) []string { r = append(r, arg) } - r[0] = filepath.Base(r[0]) + if !dcSyscall.NeedSearchToolchain(env) { + r[0] = filepath.Base(r[0]) + } return r } diff --git a/src/backend/booster/bk_dist/handler/ue4/cc/handler.go b/src/backend/booster/bk_dist/handler/ue4/cc/handler.go index a11e111b..53e08ae7 100644 --- a/src/backend/booster/bk_dist/handler/ue4/cc/handler.go +++ b/src/backend/booster/bk_dist/handler/ue4/cc/handler.go @@ -1258,7 +1258,7 @@ func (cc *TaskCC) preBuild(args []string) error { // debugRecordFileName(fmt.Sprintf("cc: pre-build ready stripLocalArgs")) // strip the args and get the server side args. - serverSideArgs := stripLocalArgs(finalArgs) + serverSideArgs := stripLocalArgs(finalArgs, cc.sandbox.Env) // replace the input file into preprocessedFile, for the next server side process. for index := range serverSideArgs { diff --git a/src/backend/booster/bk_dist/handler/ue4/cc/utils.go b/src/backend/booster/bk_dist/handler/ue4/cc/utils.go index 31f7dcf7..2b9f85b6 100644 --- a/src/backend/booster/bk_dist/handler/ue4/cc/utils.go +++ b/src/backend/booster/bk_dist/handler/ue4/cc/utils.go @@ -25,6 +25,7 @@ import ( "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/protocol" dcPump "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/pump" dcSDK "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/sdk" + dcSyscall "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/syscall" dcUtil "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/util" "github.com/TencentBlueKing/bk-turbo/src/backend/booster/common/blog" "github.com/TencentBlueKing/bk-turbo/src/backend/booster/common/codec" @@ -583,7 +584,7 @@ func getPreprocessedExt(inputFile string) string { // are pointed to by that array are aliased with the values pointed // to by 'from'. The caller is responsible for calling free() on // '*out_argv'. -func stripLocalArgs(args []string) []string { +func stripLocalArgs(args []string, env *env.Sandbox) []string { r := make([]string, 0, len(args)) // skip through argv, copying all arguments but skipping ones that ought to be omitted @@ -616,7 +617,9 @@ func stripLocalArgs(args []string) []string { r = append(r, arg) } - r[0] = filepath.Base(r[0]) + if !dcSyscall.NeedSearchToolchain(env) { + r[0] = filepath.Base(r[0]) + } return r }