go-gl/example

Cannot go get - barrage of missing deps

netpoetica opened this issue · 1 comments

Trying to use go get to grab these examples, I am encountering an endless barrage of "NO".

I'm on Mac OSX mountain lion fwiw

➜  ~  go version
go version go1.1.2 darwin/amd64

Your dependencies list gas, so I did a go get on that and had no problem with it, but then when I did

go get github.com/go-gl/examples

I got in response:

# pkg-config --cflags sdl
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
exit status 1
# github.com/go-gl/glfw
In file included from callback.go:7:
callback.h:12:21: error: GL/glfw.h: No such file or directory

So I installed SDL (with homebrew) and then tried again:

➜  ~GOPATH  go get github.com/go-gl/examples
# github.com/go-gl/glfw
In file included from callback.go:7:
callback.h:12:21: error: GL/glfw.h: No such file or directory
# github.com/banthar/Go-SDL/sdl
sdl.go:15:24: error: SDL_image.h: No such file or directory

➜  ~GOPATH  sudo find / -name sdl.pc 
Password:
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/usr/local/Cellar/sdl/1.2.15/lib/pkgconfig/sdl.pc
/usr/local/lib/pkgconfig/sdl.pc

So I have one version installed by homebrew and one that probably already came when I did make on GLEW.

I don't want to make anyone read the humongous barrage of errors I got, but, eventually I realized I also needed to seperately install SDL_Image and started thinking that maybe Go isn't getting the dependencies of these examples (Go-SDL I was seeing) so I started trying something like this:

➜  ~GOPATH  go get github.com/banthar/Go-SDL/sdl
# github.com/banthar/Go-SDL/sdl
ld: warning: unexpected dylib (/System/Library/Frameworks//Cocoa.framework/Cocoa) on link line
➜  ~GOPATH  go get github.com/go-gl/examples    
# github.com/go-gl/glfw
In file included from callback.go:7:
callback.h:12:21: error: GL/glfw.h: No such file or directory

Additionally throughout, I had gotten errors about "glu" (not "GLEW"):

➜  ~GOPATH  pkg-config glew --libs --cflags
Package glu was not found in the pkg-config search path.
Perhaps you should add the directory containing `glu.pc'
to the PKG_CONFIG_PATH environment variable
Package 'glu', required by 'glew', not found
➜  ~GOPATH  sudo find / -name glu.pc 
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

Anyone have any idea what I'm doing wrong here? I attempted to add a PKG_CONFIG_PATH environment var to my .zshrc

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig

For local and usr lib (usr/lib is glew, usr/local/lib is brew version of SDL and SDL Image).

Thanks a ton, would love to get these operational.

I have a creeping suspicion that it has something to do with the fact that I need to manually go into each example and install dependencies for that project, but I am honestly not sure (a little bit of a Go noob here but with a C++ and Nodejs background, didn't think I would run into trouble like this getting OpenGL working)

It looks like this was solved with a couple of things. Firstly, to anyone else having trouble with the examples, you may want to go down the line doing "go get X" where X is all the go-gl repos. As they fail, depending on what OpenGL dependency they are wrapping, you will need to find an install it.

For me, in addition to gas, I need to do

brew install sdl
brew install SDL_image
brew install glfw2    

Additionally, I did

brew install glfw3

It is worth noting that the dependency of THIS project is glfw2 - that's where the error about GL/glfw.h not being found comes from. If you install glfw3, it does not resolve this issue. You must install 2. I installed both for future purposes.