Skip to content

Building go-gl/gl on Windows

Today I decided I want to continue learning the programming language Go and write a small OpenGL program with it. For OpenGL I wanted to use the Go package “github.com/go-gl/gl” which usually can be installed with “go get github.com/go-gl/gl”. This, however, resulted in a bunch of undefined reference errors, because you need to install GLEW beforehand. That on the other hand is not so easy on Windows. While you can download MSVC-compatible .lib files of GLEW and MinGW32 hypothetically can use them, they won’t work for building the gl package (results in other undefined references in the likes of _imp____glew*). Instead, you need to build MinGW32 library files (.a).

Took me some time to figure it out, but these were roughly the steps it required, assuming that Go is already installed:

1. Install MinGW32 and the package mingw32-base
2. Download GLEW source code from http://glew.sourceforge.net/
3. Get the build script from http://stackoverflow.com/questions/6005076/building-glew-on-windows-with-mingw/6005262#6005262
4. Copy the build script into the GLEW source folder and execute it, this will build the library files
5. Copy the static library files (lib/libglew32.a etc.) into your MinGW32 lib folder (e.g. C:\MingW32\lib)
6. Copy the header files (include/GL/glew32.h etc.) into the MingW32 include folder (e.g. C:\MingW32\include\GL)
7. Copy lib/glew32.dll into Windows’ system32 folder
8. go get github.com/go-gl/gl

After this you should be able to use the gl package.

Advertisements

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Bunkerbewohner1

  • RT @allowe: A hundred years ago everybody owned horses and only the rich had cars. Now everybody has a car and only the rich own horses. 1 week ago
  • @viquizru hi! excuse me for using English, but my Russian sucks: Is it possible to liccense any of your questions for commercial use? 1 week ago
  • RT @thinkmariya: "Now that Uber doesn't have a CEO, COO, CTO, or CFO, I guess this is the closest it's ever been to a self-driving car comp… 1 week ago
  • I'm totally hooked on Visual Studio Team Services. It's great! 1 week ago
  • Having a look at Visual Studio Team Services and it actually looks pretty good wrt integrated agile workflow and unlimited git repos. 1 week ago

My Del.icio.us

%d bloggers like this: