diff --git a/v2/pkg/commands/bindings/bindings.go b/v2/pkg/commands/bindings/bindings.go index 28b5bca0d..82ce0d58f 100644 --- a/v2/pkg/commands/bindings/bindings.go +++ b/v2/pkg/commands/bindings/bindings.go @@ -20,8 +20,6 @@ type Options struct { ProjectDirectory string Compiler string GoModTidy bool - Platform string - Arch string TsPrefix string TsSuffix string TsOutputType string @@ -56,12 +54,11 @@ func GenerateBindings(options Options) (string, error) { } envBuild := os.Environ() - arch := options.Arch - if arch == "universal" { - arch = runtime.GOARCH - } - envBuild = shell.SetEnv(envBuild, "GOOS", options.Platform) - envBuild = shell.SetEnv(envBuild, "GOARCH", arch) + envBuild = shell.SetEnv(envBuild, "GOOS", runtime.GOOS) + envBuild = shell.SetEnv(envBuild, "GOARCH", runtime.GOARCH) + // wailsbindings is executed on the build machine. + // So, use the default C compiler, not the one set for cross compiling. + envBuild = shell.RemoveEnv(envBuild, "CC") stdout, stderr, err = shell.RunCommandWithEnv(envBuild, workingDirectory, options.Compiler, "build", "-buildvcs=false", "-tags", tagString, "-o", filename) if err != nil { diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index b4e83dd69..7263f63ae 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -234,8 +234,6 @@ func GenerateBindings(buildOptions *Options) error { Compiler: buildOptions.Compiler, Tags: buildOptions.UserTags, GoModTidy: !buildOptions.SkipModTidy, - Platform: buildOptions.Platform, - Arch: buildOptions.Arch, TsPrefix: buildOptions.ProjectData.Bindings.TsGeneration.Prefix, TsSuffix: buildOptions.ProjectData.Bindings.TsGeneration.Suffix, TsOutputType: buildOptions.ProjectData.Bindings.TsGeneration.OutputType, diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index bab40f121..6ae414967 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `DisablePanicRecovery` option to allow handle panics manually [#4136](https://github.com/wailsapp/wails/pull/4136) by [@APshenkin](https://github.com/APshenkin) ### Fixed +- Fixed build fails when cross compiling on Linux for Windows [#4262](https://github.com/wailsapp/wails/issues/4262) by [@rynsf](https://github.com/rynsf) - Fixed typescript generation of maps with key of array of structs by @joshuapare in [#4209](https://github.com/wailsapp/wails/pull/4209) - Fixed -m build flag for dev command not working when recompiling in [#4141](https://github.com/wailsapp/wails/pull/4141) by @josStorer - Fixed window restoration behavior after minimization by @superDingda in [#4109](https://github.com/wailsapp/wails/issues/4109)