pwiecz / go-fltk

A simple wrapper around FLTK 1.4 library
MIT License
120 stars 22 forks source link

build on windows #127

Open vlappa opened 4 months ago

vlappa commented 4 months ago

Sorry I'm a complete windows noob. How do I build (go generate) go-fltk on Windows 10 amd64?

I've downloaded git bash, cmake, cygwin (in the hope it did me provided the build tools) did go generate in git bash, but cmake says: unable to find "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set.

Yes I've Google, but man very unclear how to install MinGW, which package is needed exactly etc.

pwiecz commented 4 months ago

What I've used is TDM-GCC ( https://jmeubank.github.io/tdm-gcc/ ) After installing it (and cmake) I've run go generate from windows command prompt. I had to build the final library with -buildmode=exe , but maybe it's not necessary now.

vlappa commented 4 months ago

Thanks.

Error moving include\FL\fl_config.h to lib\windows\amd64\FL, rename include\FL\fl_config.h lib\windows\amd64\FL\fl_config.h: Permission denied. exit status 1

I executed the git bash shell as administrator.

vlappa commented 4 months ago

cross compiling (latest) from linux to windows fails, as if go generate wasn't run, but those windows libs are available by default afaik:

GOOS=windows GOARCH=amd64 go build main.go

undefined: fltk.Window

Not sure if CGO_ENABLED=1 is needed for cross compilation , but with it added, it gives:

# runtime/cgo
gcc: error: unrecognized command-line option ‘-mthreads’; did you mean ‘-pthread’?
vlappa commented 4 months ago

I was able to build on Windows with a older version github.com/pwiecz/go-fltk v0.0.0-20230715112806-e23ae979a995 as go generate was not needed there.

pwiecz commented 2 months ago

Have, you had an opportunity running go generate in the most recent version?