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.

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 )

Connecting to %s

Bunkerbewohner1

  • Just realized one different that might be important... one of them is a contenteditable 1 day ago
  • @nextjs At least it's consistent in browsers. So I know the mistake must be somewhere in my styles or DOM... 1 day ago
  • I'm having a weird issue where the SSR version of my @nextjs page looks slightly different than the CSR version, be… twitter.com/i/web/status/1… 1 day ago
  • RT @KialoEdu: 2022 was a busy year for us here at Kialo Edu: we spent most of our time making great new features for you! Check out our r… 6 days ago
  • loving @LastOfUsHBO - really cool seeing it come together in such a well made tv series after having played all the games. 1 week ago

My Del.icio.us

%d bloggers like this: