Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: GLEW fails to build on go tip (cannot parse GCC4.8 track-macro-expansion output) #5153

Closed
gopherbot opened this issue Mar 28, 2013 · 5 comments

Comments

@gopherbot
Copy link

commented Mar 28, 2013

by qeed.quan:

For some reason I am getting a build error using cgo with GLEW, I am running linux 64
bit version and 

go version devel +811f060da18a Thu Mar 28 15:04:25 2013 -0700 linux/amd64

with GCC 4.8

I get build errors such as these when trying to install GLEW

# gl
In file included from buffer.go:4:0:
gl.h:4:25: error: enumerator value for '__cgo_enum__8' is not an integer constant
 #define GLEW_GET_FUN(x) (*x)
                         ^
/usr/include/GL/glew.h:1685:22: note: in expansion of macro 'GLEW_GET_FUN'
 #define glGenBuffers GLEW_GET_FUN(__glewGenBuffers)
                      ^
gl.h:4:25: error: enumerator value for '__cgo_enum__9' is not an integer constant
 #define GLEW_GET_FUN(x) (*x)
                         ^
/usr/include/GL/glew.h:1679:22: note: in expansion of macro 'GLEW_GET_FUN'
 #define glBindBuffer GLEW_GET_FUN(__glewBindBuffer)
                      ^
gl.h:4:25: error: enumerator value for '__cgo_enum__10' is not an integer constant
 #define GLEW_GET_FUN(x) (*x)
                         ^
the errors continue from here but they are mostly the same. 

The GLEW header file does 
#define GLEW_GET_FUN(x) (x)
but it needed 
#define GLEW_GET_FUN(x) (*x)
to compile properly when cgo was still working, or else one would get the error:
  could not determine kind of name for C.glDeleteBuffers
and so on.

I have attached my GL bindings to test with glew.

Attachments:

  1. gl.zip (6539 bytes)
@remyoudompheng

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2013

Comment 1:

Did it work when using GCC 4.7 ?
@gopherbot

This comment has been minimized.

Copy link
Author

commented Apr 1, 2013

Comment 2 by qeed.quan:

I don't have GCC 4.7 to test, but I assume yes. I tested it today with clang (CC=clang
go install gl) and it works, I am using clang version 3.2 (tags/RELEASE_32/final)
@remyoudompheng

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2013

Comment 3:

GCC 4.8 macro expansion tracking modifies the output. cgo parses the output of GCC on a
specially crafted file to classify identifiers.
See issue #5118 for a workaround to disable the macro expansion tracking.

Labels changed: added cgo.

@gopherbot

This comment has been minimized.

Copy link
Author

commented Apr 1, 2013

Comment 4 by qeed.quan:

thanks alot, the workaround fixed it.
@minux

This comment has been minimized.

Copy link
Member

commented Apr 2, 2013

Comment 5:

Status changed to Duplicate.

Merged into issue #5118.

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.