faiface/pixel

Examples/Tutorials do not work, on fresh install of golang

Closed this issue · 6 comments

Hello. Fairly new to go (never done anything requiring packages).
I'd like to play with this library, however, I follow the steps with a new install of golang, and cannot run the tutorials/examples.

my 'main.go' includes everything before the "Vsync" section from https://github.com/faiface/pixel/wiki/Creating-a-Window
I have also tried the examples repository (faiface/pixel-examples), but they do not run, and fail with the exact same error.
Are there some missing steps in installation in the readmes, or incompatability between versions?
Or perhaps I'm simply missing something that is obvious to seasoned go devs.

Transcript included:

C:\Development\Go\pixelgame
λ go version
go version go1.14.6 windows/amd64

C:\Development\Go\pixelgame
λ go get github.com/faiface/pixel

C:\Development\Go\pixelgame
λ go run main.go
C:\Users\ninja\go\src\github.com\faiface\pixel\pixelgl\canvas.go:9:2: cannot find package "github.com/faiface/glhf" in any of:
        c:\go\src\github.com\faiface\glhf (from $GOROOT)
        C:\Users\ninja\go\src\github.com\faiface\glhf (from $GOPATH)
C:\Users\ninja\go\src\github.com\faiface\pixel\pixelgl\canvas.go:10:2: cannot find package "github.com/faiface/mainthread" in any of:
        c:\go\src\github.com\faiface\mainthread (from $GOROOT)
        C:\Users\ninja\go\src\github.com\faiface\mainthread (from $GOPATH)
C:\Users\ninja\go\src\github.com\faiface\pixel\pixelgl\canvas.go:7:2: cannot find package "github.com/go-gl/gl/v3.3-core/gl" in any of:
        c:\go\src\github.com\go-gl\gl\v3.3-core\gl (from $GOROOT)
        C:\Users\ninja\go\src\github.com\go-gl\gl\v3.3-core\gl (from $GOPATH)
C:\Users\ninja\go\src\github.com\faiface\pixel\pixelgl\input.go:8:2: cannot find package "github.com/go-gl/glfw/v3.3/glfw" in any of:
        c:\go\src\github.com\go-gl\glfw\v3.3\glfw (from $GOROOT)
        C:\Users\ninja\go\src\github.com\go-gl\glfw\v3.3\glfw (from $GOPATH)
C:\Users\ninja\go\src\github.com\faiface\pixel\pixelgl\canvas.go:12:2: cannot find package "github.com/go-gl/mathgl/mgl32" in any of:
        c:\go\src\github.com\go-gl\mathgl\mgl32 (from $GOROOT)
        C:\Users\ninja\go\src\github.com\go-gl\mathgl\mgl32 (from $GOPATH)
C:\Users\ninja\go\src\github.com\faiface\pixel\pixelgl\canvas.go:13:2: cannot find package "github.com/pkg/errors" in any of:
        c:\go\src\github.com\pkg\errors (from $GOROOT)
        C:\Users\ninja\go\src\github.com\pkg\errors (from $GOPATH)
delp commented

you need to install glhf

Shouldn't it be installed automatically by go's package manager, if it's a dependency of pixel? (At least that would be the expected behaviour of a package manager)

That is a step that is not obvious and should be included as well as any other dependencies. It would help get people started who don't know about how go's package manager works (or doesn't).

I tried installing the following, but still cannot run it.

λ go get github.com/faiface/glhf
# github.com/go-gl/gl/v3.3-core/gl
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

λ go get -u github.com/go-gl/gl/v3.3-core/gl
# github.com/go-gl/gl/v3.3-core/gl
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

λ go get github.com/go-gl/glfw/v3.3/glfw
# github.com/go-gl/glfw/v3.3/glfw
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

λ go run main.go
# github.com/go-gl/glfw/v3.3/glfw
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
# github.com/go-gl/gl/v3.3-core/gl
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

Running the final command, no windows pop up.

I can add I am on 64-bit windows 10, and am running the platformer example, if that helps.

Did you install msys2 and the compilation dependencies? If so, do you have an old install of mingw that's higher in your path?
Take a look here if you haven't already for the exact dependencies you need: Building on Windows.

It looks like you might have an out of date compiler that Go is picking up.

you need to install glhf

See my response, I installed it and other dependencies, and still had errors.

Did you install msys2 and the compilation dependencies? If so, do you have an old install of mingw that's higher in your path?
Take a look here if you haven't already for the exact dependencies you need: Building on Windows.

It looks like you might have an out of date compiler that Go is picking up.

Yes, that's probably it. I have a whole slew of things like MINGW and cygwin installed. Most of the time they don't have any problems.

Unfortunately I need those for other things I do, and can't install them or re-order my PATH without breaking those other things.

You could install msys2 and only add it to you PATH for the cmd session where you're building your Pixel project. Not a great solution, but if you can't add it to your PATH, it's the only one I can think of.

If you're using VS Code, you could probably modify the PATH in the launch config; otherwise you could have a custom cmd prompt for Pixel that adds the msys2 installation to the PATH temporarily and automatically when that prompt comes up.

delp commented

@ninjapretzel Since this is not a defect of Pixel, I'm going to mark this issue as closed. However, if you drop into our Discord server I'm sure you could get help troubleshooting your development environment.