Search code examples
gofyne

building golang app with fyne package for windows


Hello guys i want to build my fyne gui application for Microsoft windows machine, when i try to build it using the next command

env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build .

I get this Error message # runtime/cgo gcc: error: unrecognized command-line option ‘-mthreads’; did you mean ‘-pthread’? y so I need to build this application for Windows use and for sure the application contains a GUI built with the fyne.io package I searched on the building the (fyne) application for Windows and I found this https://developer.fyne.io/started/cross-compiling and I need to explain this for me I think there is a way for building the application using docker but I have no background for using docker? the last solution for me is to ask here on StackOverflow so i'm using linux machine and i want to build the app for Microsoft windows. I appreciate your help and thanks


Solution

  • Following the instructions on that page and your command snippet is missing the CC environment to reference the C compiler for windows. Once that is sorted it should work. As you note it is possible to use fyne-cross as long as Docker is installed. No setup required, just the standard download and the fyne-cross “go get” and execute the commands shown in the docs.