Description
I use wails build -platform windows, if use CGO, it can't build.
fcying@home:~/test/wails $ wails build -platform windows
Wails CLI v2.9.1 # Build Options
Platform(s) | windows
Compiler | /usr/local/bin/go
Skip Bindings | false
Build Mode | production
Devtools | false
Frontend Directory | /home/fcying/test/wails/frontend
Obfuscated | false
Skip Frontend | false
Compress | false
Package | true
Clean Bin Dir | false
LDFlags |
Tags | []
Race Detector | false
# Building target: windows/amd64
• Generating bindings: Done.
• Installing frontend dependencies: Done.
• Compiling frontend: Done.
• Generating application assets: Done.
• Compiling application: # wails
./main.go:16:9: undefined: NewApp
ERROR exit status 1
ERROR exit status 1
after set CC CXX
export CXX=x86_64-w64-mingw32-g++
export CC=x86_64-w64-mingw32-gcc
wails build -platform windows Wails CLI v2.9.1
# Build Options
Platform(s) | windows
Compiler | /usr/local/bin/go
Skip Bindings | false
Build Mode | production
Devtools | false
Frontend Directory | /home/fcying/test/wails/frontend
Obfuscated | false
Skip Frontend | false
Compress | false
Package | true
Clean Bin Dir | false
LDFlags |
Tags | []
Race Detector | false
# Building target: windows/amd64
# Building target: windows/amd64
• Generating bindings: ERROR
# runtime/cgo
gcc_linux_amd64.c: In function ‘_cgo_sys_thread_start’:
gcc_linux_amd64.c:57:9: error: unknown type name ‘sigset_t’; did you mean ‘_sigset_t’?
57 | sigset_t ign, oset;
| ^~~~~~~~
| _sigset_t
gcc_linux_amd64.c:62:9: error: implicit declaration of function ‘sigfillset’ [-Werror=implicit-function-declaration]
62 | sigfillset(&ign);
| ^~~~~~~~~~
gcc_linux_amd64.c:57:23: error: unused variable ‘oset’ [-Werror=unused-variable]
57 | sigset_t ign, oset;
| ^~~~
cc1: all warnings being treated as errors
exit status 1
ERROR
# runtime/cgo
gcc_linux_amd64.c: In function ‘_cgo_sys_thread_start’:
gcc_linux_amd64.c:57:9: error: unknown type name ‘sigset_t’; did you mean ‘_sigset_t’?
57 | sigset_t ign, oset;
| ^~~~~~~~
| _sigset_t
gcc_linux_amd64.c:62:9: error: implicit declaration of function ‘sigfillset’ [-Werror=implicit-function-declaration]
62 | sigfillset(&ign);
| ^~~~~~~~~~
gcc_linux_amd64.c:57:23: error: unused variable ‘oset’ [-Werror=unused-variable]
57 | sigset_t ign, oset;
| ^~~~
cc1: all warnings being treated as errors
exit status 1
To Reproduce
- wails init -t vue-ts -n wails
- cd wails && wails build -platform windows #build ok
- add example c code to app.go
package main
/*
void test() {
}
*/
import "C"
- wails build -platform windows # error
- export CC=x86_64-w64-mingw32-gcc
- export CXX=x86_64-w64-mingw32-g++
- wails build -platform windows # error
Expected behaviour
cross build work fine
Screenshots
No response
Attempted Fixes
No response
System Details
wails doctor
Wails Doctor
# Wails
Version | v2.9.1
Package Manager | apt
# System
┌───────────────────────────────────────────────────┐ | OS | Debian GNU/Linux |
| Version | 12 |
| ID | debian |
| Go Version | go1.22.3 |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 7 5700X 8-Core Processor |
| GPU | Unknown |
| Memory | 20GB |
└───────────────────────────────────────────────────┘
# Dependencies
┌──────────────────────────────────────────────────────────────────────┐ | Dependency | Package Name | Status | Version |
| *docker | docker.io | Available | 20.10.24+dfsg1-1+b3 |
| gcc | build-essential | Installed | 12.9 |
| libgtk-3 | libgtk-3-dev | Installed | 3.24.38-2~deb12u1 |
| libwebkit | libwebkit2gtk-4.0-dev | Installed | 2.44.3-1~deb12u1 |
| npm | npm | Installed | 10.5.0 |
| *nsis | nsis | Available | 3.08-3+deb12u1 |
| pkg-config | pkg-config | Installed | 1.8.1-1 |
└────────────────────── * - 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_
Description
I use
wails build -platform windows, if use CGO, it can't build.after set CC CXX
To Reproduce
Expected behaviour
cross build work fine
Screenshots
No response
Attempted Fixes
No response
System Details
wails doctor Wails Doctor # Wails Version | v2.9.1 Package Manager | apt # System ┌───────────────────────────────────────────────────┐ | OS | Debian GNU/Linux | | Version | 12 | | ID | debian | | Go Version | go1.22.3 | | Platform | linux | | Architecture | amd64 | | CPU | AMD Ryzen 7 5700X 8-Core Processor | | GPU | Unknown | | Memory | 20GB | └───────────────────────────────────────────────────┘ # Dependencies ┌──────────────────────────────────────────────────────────────────────┐ | Dependency | Package Name | Status | Version | | *docker | docker.io | Available | 20.10.24+dfsg1-1+b3 | | gcc | build-essential | Installed | 12.9 | | libgtk-3 | libgtk-3-dev | Installed | 3.24.38-2~deb12u1 | | libwebkit | libwebkit2gtk-4.0-dev | Installed | 2.44.3-1~deb12u1 | | npm | npm | Installed | 10.5.0 | | *nsis | nsis | Available | 3.08-3+deb12u1 | | pkg-config | pkg-config | Installed | 1.8.1-1 | └────────────────────── * - 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!