From 44cb4f2649a4eeab93d8e81df4c56fda992960ae Mon Sep 17 00:00:00 2001 From: Li Jie Date: Fri, 22 Aug 2025 07:40:52 +0800 Subject: [PATCH] report error if target cpu is not set --- internal/crosscompile/crosscompile.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/crosscompile/crosscompile.go b/internal/crosscompile/crosscompile.go index 7fad4419..8e4c8ec5 100644 --- a/internal/crosscompile/crosscompile.go +++ b/internal/crosscompile/crosscompile.go @@ -427,6 +427,11 @@ func useTarget(targetName string) (export Export, err error) { return export, fmt.Errorf("target '%s' does not have a valid LLVM target triple", targetName) } + cpu := config.CPU + if cpu == "" { + return export, fmt.Errorf("target '%s' does not have a valid CPU configuration", targetName) + } + // Check for ESP Clang support for target-based builds clangRoot, err := getESPClangRoot() if err != nil { @@ -461,7 +466,6 @@ func useTarget(targetName string) (export Export, err error) { // The following parameters are inspired by tinygo/builder/library.go // Handle CPU configuration - cpu := config.CPU if cpu != "" { // X86 has deprecated the -mcpu flag, so we need to use -march instead. // However, ARM has not done this.