wails icon indicating copy to clipboard operation
wails copied to clipboard

Cannot cross compile for windows on Mac after updating from v2.9.2 to v2.10.1

Open GregorExner opened this issue 10 months ago • 8 comments

Description

After updating my wails CLI to the most recent version (2.10.1) coming from 2.9.2 I cannot cross compile anymore.

To Reproduce

  1. Create new project on macOS machine: wails -init -n test
  2. Try to build for windows: wails build -platform windows
  3. Error message appears: "Generating bindings: ERROR", fork/exec /var/folders/v4/5xlqls356_x9qdg07d5w8skh0000gp/T/wailsbindings: exec format error

Expected behaviour

Cross compilation of application possible like in version 2.9.2.

Screenshots

Image

Attempted Fixes

Update of golang to latest version.

System Details

Wails Doctor          
                                

                                                                                                                                                                                                   
# Wails
Version | v2.10.1


# System
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | MacOS                                                                                                                       |
| Version      | 15.3.1                                                                                                                      |
| ID           | 24D70                                                                                                                       |
| Go Version   | go1.23.2                                                                                                                    |
| Platform     | darwin                                                                                                                      |
| Architecture | arm64                                                                                                                       |
| CPU 1        | Apple M1 Max                                                                                                                |
| CPU 2        | Apple M1 Max                                                                                                                |
| GPU          | Chipset Model: Apple M1 Max Type: GPU Bus: Built-In Total Number of Cores: 32 Vendor: Apple (0x106b) Metal Support: Metal 3 |
| Memory       | 64GB                                                                                                                        |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────────┐
| Dependency                | Package Name | Status    | Version         |
| Xcode command line tools  | N/A          | Installed | 2409            |
| Nodejs                    | N/A          | Installed | 22.13.1         |
| npm                       | N/A          | Installed | 10.9.2          |
| *Xcode                    | N/A          | Installed | 16.2 (16C5032a) |
| *upx                      | N/A          | Available |                 |
| *nsis                     | N/A          | Available |                 |
|                                                                        |
└─────────────────────── * - Optional Dependency ────────────────────────┘

# Diagnosis
Optional package(s) installation details: 
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

GregorExner avatar Mar 04 '25 20:03 GregorExner

In the meantime I have downgraded to Wails version 2.9.3 (with go 1.4 support) and cross-compiling for windows works with this version.

GregorExner avatar Mar 05 '25 08:03 GregorExner

I am new to wails and for a moment thought it is not really cross platform ;) Downgrading indeed works, thanks for the suggestion. Hopefully this gets fixed soon.

Gys avatar Mar 06 '25 11:03 Gys

Yep, thanks for confirming the issue. 👍 I also hope the the issue gets fixed soon. But I think they are currently working hard on v3. Lets see if there is time for a 2.9.4 😎

GregorExner avatar Mar 06 '25 14:03 GregorExner

I have the same problem to build an arm64 version too from windows.

# Building target: windows/arm64

  • Generating bindings:   ERROR

          fork/exec C:\Users\laure\AppData\Local\Temp\wailsbindings.exe: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

ellis2323 avatar Mar 11 '25 15:03 ellis2323

If you want to build your project for windows on mac before the update, use the command below

brew install mingw-w64

and

env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_CXXFLAGS="-IC:\msys64\mingw64\include" wails build -ldflags '-extldflags "-static"' -skipbindings

ghost avatar Mar 15 '25 03:03 ghost

最后咋解决的

zk3151463 avatar Mar 26 '25 10:03 zk3151463

This one seems to keep coming up >.<

leaanthony avatar Mar 31 '25 10:03 leaanthony

I used CGO_ENABLED=1 GOARCH=arm64 CC=aarch64-linux-gnu-gcc wails build -platform windows/amd64 -skipbindings to compile successfully.

Soonogo avatar Apr 05 '25 17:04 Soonogo

Some new News regarding this issue? -skipbindings isnt an option because of changed bindings...

StephanMa avatar Nov 05 '25 11:11 StephanMa