go-gl-legacy / gl

Go bindings for OpenGL
BSD 3-Clause "New" or "Revised" License
342 stars 52 forks source link

Problems compiling on ubuntu 10.10 #35

Closed lukad closed 11 years ago

lukad commented 13 years ago

I'm trying to compile Go-OpenGL on ubuntu 10.10 with the latest version of Go but it gives me the following error:

gomake -C gl
make[1]: Entering directory `/home/luka/Desktop/Go-OpenGL/gl'
CGOPKGPATH= cgo --  gl.go
touch _obj/_cgo_run
8g  -o _go_.8 gl_defs.go _obj/gl.cgo1.go _obj/_cgo_gotypes.go
gl.go:122[_obj/gl.cgo1.go:125]: cannot use _Ctypedef_GLuint(shader) (type _Ctypedef_GLuint) as type _Ctypedef_GLint in function argument
make[1]: *** [_go_.8] Error 1
make[1]: Leaving directory `/home/luka/Desktop/Go-OpenGL/gl'
make: *** [gl] Fehler 2

Also, I don't really see what could be wrong with gl.go:122. I just got into Go and don't understand this so could anyone please tell me whats wrong?

banthar commented 13 years ago

in gl.go:122 change

C.glGetShaderiv(C.GLuint(shader), C.GLenum(INFO_LOG_LENGTH), &len)

to:

C.glGetShaderiv(C.GLint(shader), C.GLenum(INFO_LOG_LENGTH), &len)

See if it will work. Also, post output of glewinfo | head

lukad commented 13 years ago

Changing line 122 gives me this:

gomake -C gl
make[1]: Entering directory `/home/luka/Desktop/Go-OpenGL/gl'
CGOPKGPATH= cgo --  gl.go
touch _obj/_cgo_run
8g  -o _go_.8 gl_defs.go _obj/gl.cgo1.go _obj/_cgo_gotypes.go
gl.go:110[_obj/gl.cgo1.go:113]: cannot use _Ctypedef_GLint(shader) (type _Ctypedef_GLint) as type _Ctypedef_GLuint in function argument
gl.go:122[_obj/gl.cgo1.go:125]: cannot use _Ctypedef_GLuint(shader) (type _Ctypedef_GLuint) as type _Ctypedef_GLint in function argument
make[1]: *** [_go_.8] Error 1
make[1]: Leaving directory `/home/luka/Desktop/Go-OpenGL/gl'
make: *** [gl] Fehler 2

glewinfo | head :

Error: API mismatch: the NVIDIA kernel module has version 260.19.06,
but this NVIDIA driver component has version 270.41.06.  Please make
sure that the kernel module and all NVIDIA driver components
have the same version.
---------------------------
    GLEW Extension Info
---------------------------

GLEW version 1.5.2
Reporting capabilities of display :0.0, visual 0x2b
Running on a GeForce 9600 GT/PCI/SSE2 from NVIDIA Corporation
OpenGL version 2.1.2 NVIDIA 260.19.06 is supported

GL_VERSION_1_1:                                                OK 
banthar commented 13 years ago

Are you sure you changed the correct line? It looks like you changed line 110 instead of 122.

lukad commented 13 years ago

I guess you are right, I changed the wrong line. But this time I changed the right one and it still won't compile.

gomake -C gl
make[1]: Entering directory `/home/luka/Desktop/Go-OpenGL/gl'
CGOPKGPATH= cgo --  gl.go
touch _obj/_cgo_run
8g  -o _go_.8 gl_defs.go _obj/gl.cgo1.go _obj/_cgo_gotypes.go
gl.go:108[_obj/gl.cgo1.go:111]: cannot use _Ctypedef_GLint(shader) (type _Ctypedef_GLint) as type _Ctypedef_GLuint in function argument
gl.go:123[_obj/gl.cgo1.go:126]: cannot use _Ctypedef_GLuint(shader) (type _Ctypedef_GLuint) as type _Ctypedef_GLint in function argument
make[1]: *** [_go_.8] Error 1
make[1]: Leaving directory `/home/luka/Desktop/Go-OpenGL/gl'
make: *** [gl] Fehler 2
gregghz commented 13 years ago

I had the same issue, changing line 137 in the same manner seemed to solve it for me (after making the change suggested above).

Kalthorn commented 13 years ago

I'm also unable to build with similar errors. Updating go to r57 didn't change anything.

This is what I get first: gl.go:123[_obj/gl.cgo1.go:126]: cannot use _Ctypedef_GLuint(shader) (type _Ctypedef_GLuint) as type _Ctypedef_GLint in function argument

If I make the suggested change, I get the same error on line 122/123 along with an additional one on line 108. Making a change to 137 or 108 just produces more errors of the same uint/int variety.

Also, the NEWS file reports that glew is no longer needed but that was the first error I hit: a dependency on glew.h. And indeed gl_defs.c still includes it.

It's worth mentioning that I have the 0xe2 branch of Go-SDL but it looks as if that is only imported for the examples.

banthar commented 13 years ago

You need to change those types everywhere, or update your GLEW to 1.5.8.

Kalthorn commented 13 years ago

Thanks, GLEW 1.5.8 fixed it. GLEW 1.6.0 had problems though. Still threw the error in line 122 but fixing that only caused 108 to blow up instead of adding the 108 error while keeping the error on 122 (as happened with 1.5.7).

Anyway, I'm building successfully now, thanks banthar!