-
|
Thank you for the great work you have done for Wails. I am trying to get Wails to work on my Ubuntu 24.04 machine. I can compile the quickstart example no issue, but for some reason when I try to add more golang code, it is stuck on If I build with I have not yet added any code on the app.go or bundled any other assets in embed. I am not using any added build flags beyond the webkit one needed for support on Ubuntu 24.04 and am not using custom dev env tools like nix etc. app.go package main
import (
"context"
"fmt"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)
}//go:embed all:frontend/dist
var assets embed.FS
// i have some other code here but it is omitted in this example since I don't think
// it is relevant and doesn't touch anything about the wails app. It is just some helpers functions
// and hotkey setup that doesn't do anything until runtime
...
// Create application with options
err := wails.Run(&options.App{
Title: "my-app",
Width: 1024,
Height: 768,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []any{
app,
},
})
if err != nil {
println("Error:", err.Error())
}My go.mod is relatively simple. I don't think I have too many dependencies |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Hi @C-Loftus! I'm Dosu and I’m helping the wails team. The Wails build can hang at "generating bindings" if your application code doesn't exit cleanly after Common causes include: recursive or complex types in your bindings, issues with local replace directives in Skipping binding generation isn't safe long-term; any backend changes need fresh bindings for the frontend to work correctly [docs]. If you still get stuck, try running with verbose output and check for any logs or errors. If possible, share a minimal reproducible example—sometimes even helper functions or struct fields can cause unexpected hangs due to how reflection scans types for bindings [source]. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
Ah great the bot gave some useful info. I had a function running a key handler in // Create application with options
err = wails.Run(&options.App{
Title: "orca-helper",
Width: 1024,
Height: 768,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []any{
app,
},
})
if err != nil {
println("Error:", err.Error())
}
go func() {
err = handleKeys()
}()by moving my handle keys into a separate go routine it now works. |
Beta Was this translation helpful? Give feedback.
-
|
This tells me you're using v2 😄 The way that bindings work in v2 is that a special build is made so that the structs get bound and then queried using reflection to see what is available. Bindings are generated from that information. Unfortunately, anything that's blocking in the main program will look like an infinite loop. An alternative is to add the blocking operations to your OnStartup callback. We should probably have a timeout on the build and suggest a help page as this comes up a lot 😄 |
Beta Was this translation helpful? Give feedback.
Hi @C-Loftus! I'm Dosu and I’m helping the wails team.
The Wails build can hang at "generating bindings" if your application code doesn't exit cleanly after
wails.Run(), or if there are infinite loops or blocking operations—even ones that only run during binding generation. This phase runs your app's main function up towails.Run()and expects it to terminate promptly; otherwise, the CLI waits indefinitely and can't be interrupted easily [docs].Common causes include: recursive or complex types in your bindings, issues with local replace directives in
go.mod, or dependency lock-ups. Your local replace for Wails (/home/host/go/pkg/mod) could be a factor—try removing it and using the stand…