gl icon indicating copy to clipboard operation
gl copied to clipboard

Cannot cross-compile from Linux to Windows

Open vonaka opened this issue 2 years ago • 3 comments

I'm trying to compile my application from Linux to Windows. I use go-gl jointly with go-sdl2 and to compile the program I follow these instructions. Additionally, I set CGO_CFLAGS to -DTAG_WINDOWS -D_WIN32 and CGO_LDFLAGS to -lopengl32 and I run go build with WGL tag:

env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" GOOS="windows" \
CGO_LDFLAGS="-lmingw32 -lSDL2 -lSDL2_image -lSDL2_ttf -lopengl32" \
CGO_CFLAGS="-D_REENTRANT -DTAG_WINDOWS -D_WIN32" \
go build -tags WGL -x test.go

Unfortunately, when I run the program on my Windows machine gl.Init fails to load glGetnTexImage. Following README, I call gl.Init after activating OpenGL context:

sdl.SetHint(sdl.HINT_RENDER_DRIVER, "opengl")
if glContext, err = window.GLCreateContext(); err != nil {
	//...
}
window.GLMakeCurrent(glContext)
if err = gl.Init(); err != nil {
	//...
}

On Windows I have opengl 4.6.

vonaka avatar Apr 09 '23 16:04 vonaka

Does this have an update by any chance?

Attempting to do the same thing, but:

package command-line-arguments
        imports github.com/duysqubix/gobc/internal/windows
        imports github.com/gopxl/pixel/v2/pixelgl
        imports github.com/go-gl/gl/v3.3-core/gl: build constraints exclude all Go files in /home/rpl-node/go/pkg/mod/github.com/go-gl/[email protected]/v3.3-core/gl

duysqubix avatar Oct 20 '23 15:10 duysqubix

Does this have an update by any chance?

Attempting to do the same thing, but:

package command-line-arguments
        imports github.com/duysqubix/gobc/internal/windows
        imports github.com/gopxl/pixel/v2/pixelgl
        imports github.com/go-gl/gl/v3.3-core/gl: build constraints exclude all Go files in /home/rpl-node/go/pkg/mod/github.com/go-gl/[email protected]/v3.3-core/gl

I haved this issue, ensure mingw is correctly set in your var environnement

vincent-alxr avatar Jan 19 '24 06:01 vincent-alxr