wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
24.44k stars 1.17k forks source link

build arm64 in linux error #3447

Open veerdone opened 4 months ago

veerdone commented 4 months ago

Description

Run wails build -platform=linux/arm64 then I got error

To Reproduce

  1. wails init -n myproject -t vue
  2. cd myproject
  3. wails build -platform=linux/arm64

Expected behaviour

Wails CLI v2.8.1

# Build Options

Platform(s)        | linux/arm64
Compiler           | /usr/local/go/bin/go
Skip Bindings      | false
Build Mode         | production
Devtools           | false
Frontend Directory | /home/ubuntu/myproject/frontend
Obfuscated         | false
Skip Frontend      | false
Compress           | false
Package            | true
Clean Bin Dir      | false
LDFlags            |
Tags               | []
Race Detector      | false

# Building target: linux/arm64

  • Generating bindings: Done.
  • Installing frontend dependencies: Done.
  • Compiling frontend: Done.
  • Compiling application: # runtime/cgo
gcc_arm64.S: Assembler messages:
gcc_arm64.S:28: Error: no such instruction: `stp x29,x30,[sp,'
gcc_arm64.S:32: Error: too many memory references for `mov'
gcc_arm64.S:34: Error: no such instruction: `stp x19,x20,[sp,'
gcc_arm64.S:37: Error: no such instruction: `stp x21,x22,[sp,'
gcc_arm64.S:40: Error: no such instruction: `stp x23,x24,[sp,'
gcc_arm64.S:43: Error: no such instruction: `stp x25,x26,[sp,'
gcc_arm64.S:46: Error: no such instruction: `stp x27,x28,[sp,'
gcc_arm64.S:50: Error: too many memory references for `mov'
gcc_arm64.S:51: Error: too many memory references for `mov'
gcc_arm64.S:52: Error: too many memory references for `mov'
gcc_arm64.S:54: Error: no such instruction: `blr x20'
gcc_arm64.S:55: Error: no such instruction: `blr x19'
gcc_arm64.S:57: Error: no such instruction: `ldp x27,x28,[sp,'
gcc_arm64.S:60: Error: no such instruction: `ldp x25,x26,[sp,'
gcc_arm64.S:63: Error: no such instruction: `ldp x23,x24,[sp,'
gcc_arm64.S:66: Error: no such instruction: `ldp x21,x22,[sp,'
gcc_arm64.S:69: Error: no such instruction: `ldp x19,x20,[sp,'
gcc_arm64.S:72: Error: no such instruction: `ldp x29,x30,[sp],'

Screenshots

No response

Attempted Fixes

No response

System Details

Wails Doctor

# Wails
Version         | v2.8.1
Package Manager | apt

# System
┌────────────────────────────────────────────────────┐
| OS           | Ubuntu                              |
| Version      | 22.04                               |
| ID           | ubuntu                              |
| Go Version   | go1.21.9                            |
| Platform     | linux                               |
| Architecture | amd64                               |
| CPU          | 12th Gen Intel(R) Core(TM) i3-12100 |
| Memory       | 2GB                                 |
└────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.5-0ubuntu1~22.04.1 |
| gcc        | build-essential       | Installed | 12.9ubuntu3             |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.33-1ubuntu2        |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.0-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.5.0                  |
| *nsis      | nsis                  | Available | 3.08-2                  |
| pkg-config | pkg-config            | Installed | 0.29.2                  |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

# Diagnosis
Optional package(s) installation details:
  - docker: sudo apt install docker.io
  - nsis: sudo apt install nsis

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

atterpac commented 4 months ago

Ensure you have a arm64 cross compiler installed and are setting your CC to that compiler see https://github.com/golang/go/issues/28966

veerdone commented 4 months ago

Ensure you have a arm64 cross compiler installed and are setting your CC to that compiler see golang/go#28966

I try install gcc-arm-linux-gnueabi and set env CC=arm-linux-gnueabihf-gcc, then I run build got

# Building target: linux/arm64

  • Generating bindings:   ERROR
          # runtime/cgo
          arm-linux-gnueabihf-gcc: error: unrecognized command-line option '-m64'

          exit status 1

  ERROR
          # runtime/cgo
          arm-linux-gnueabihf-gcc: error: unrecognized command-line option '-m64'

          exit status 1
huwei14 commented 2 months ago

try run ‘CGO_ENABLED=1 GOARCH=arm64 CC=arm-linux-gnueabihf-gcc go build -tags desktop,production -ldflags "-w -s" ’

I build success by this command

wudimenghuan commented 2 months ago

I have this same problem