ANNOUNCE: HPong-0.1.2: A simple OpenGL Pong game based on GLFW

About two days ago the beta version of the Haskell Platform was released. Since it comes with an OpenGL library, it is now trivially easy to start making OpenGL programs with Haskell. To test this, I decided to make a simple Pong clone for two reasons: * To experiment with making an OpenGL game * I chose to use the GLFW instead of the GLUT library because GLUT doesn’t respond to closing a window with the close button very well. However, I could only find one piece of sample code for GLFW. Because of that, I decided to make a small game that others can use as a starting point for their own games. The controls are very simple: The up and down arrow keys move your paddle and Esc quits the game. This is my first upload to Hackage, so any comments or suggestions are welcome.

I don't know the exact reason but this should not fail since I have Debian packaged ghc 6.10.1 and OpenGL-2.2.1.1 on my system. I think this is because the filename of the OpenGL shared library is /usr/lib/libGL.so.1 rather than libGL.so. This is why we have two binary distributions for Linux because editline library has the same naming issues in Debian. So, this may be Debian packaging problem of OpenGL bindings. But the interesting thing is that I was able to work around this in Debian, by temporarily making a symbolic link libGL.so pointing to libGL.so.1 and it hpong built successfully. Once it builds, hpong still runs even if I delete the symbolic link libGL.so. So, there is also a possibility that what may be wrong is with the build system (cabal or ghc). Thanks in advance for related library packaging mangers and developers, and here are the details of failure: kyagrd@kyagrd:~/cscs/stlcwpat$ uname -a Linux kyagrd 2.6.26-2-686 #1 SMP Thu Mar 26 01:08:11 UTC 2009 i686 GNU/Linux kyagrd@kyagrd:~/cscs/stlcwpat$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.10.1 kyagrd@kyagrd:~/cscs/stlcwpat$ which ghc /usr/bin/ghc kyagrd@kyagrd:~/cscs/stlcwpat$ cabal update Downloading the latest package list from hackage.haskell.org kyagrd@kyagrd:~/cscs/stlcwpat$ cabal install HPong Resolving dependencies... Configuring HPong-0.1.2... Preprocessing executables for HPong-0.1.2... Building HPong-0.1.2... [1 of 1] Compiling Main ( HPong.hs, dist/build/hpong/hpong-tmp/Main.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package syb ... linking ... done. Loading package base-3.0.3.0 ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package containers-0.2.0.0 ... linking ... done. Loading package transformers-0.1.4.0 ... linking ... done. Loading package data-accessor-0.2.0.2 ... linking ... done. Loading package packedstring-0.1.0.1 ... linking ... done. Loading package pretty-1.0.1.0 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package utility-ht-0.0.4 ... linking ... done. Loading package data-accessor-template-0.2.1.1 ... linking ... done. Loading package OpenGL-2.2.1.1 ... <command line>: can't load .so/.DLL for: GL (libGL.so: cannot open shared object file: No such file or directory) cabal: Error: some packages failed to install: HPong-0.1.2 failed during the building phase. The exception was: exit: ExitFailure 1 kyagrd@kyagrd:~/cscs/stlcwpat$ ghc-pkg list /usr/lib/ghc-6.10.1/./package.conf: ALUT-2.1.0.0, Cabal-1.6.0.1, Diff-0.1.2, GLUT-2.1.1.2, HDBC-2.1.0, HDBC-postgresql-2.1.0.1, HGL-3.2.0.0, HUnit-1.2.0.3, OpenAL-1.3.1.1, OpenGL-2.2.1.1, QuickCheck-2.1.0.1, Stream-0.2.2, X11-1.4.5, X11-xft-0.3, array-0.2.0.0, arrows-0.4.1, base-3.0.3.0, base-4.0.0.0, binary-0.5, bytestring-0.9.1.4, cairo-0.10.0, cgi-3001.1.7.1, containers-0.2.0.0, convertible-1.0.2, directory-1.0.0.2, editline-0.2.1.0, fgl-5.4.2.2, filepath-1.1.0.1, (ghc-6.10.1), ghc-prim-0.1.0.0, gio-0.10.0, glade-0.10.0, glib-0.10.0, gstreamer-0.10.0, gtk-0.10.0, gtkglext-0.10.0, gtksourceview2-0.10.0, haskell-src-1.0.1.3, haskell98-1.0.1.0, hpc-0.5.0.2, hslogger-1.0.8, html-1.0.1.2, integer-0.1.0.0, irc-0.4.3, mtl-1.1.0.2, network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1, packedstring-0.1.0.1, parallel-1.1.0.0, parsec-3.0.0, pretty-1.0.1.0, process-1.0.1.0, random-1.0.0.1, regex-base-0.93.1, regex-compat-0.92, regex-posix-0.93.1, rts-1.0, soegtk-0.10.0, stm-2.1.1.2, svgcairo-0.10.0, syb-0.1.0.0, syb-with-class-0.5.1, tagsoup-0.6, template-haskell-2.3.0.0, terminfo-0.3.0.1, time-1.1.2.3, unix-2.3.1.0, utf8-string-0.3.4, xhtml-3000.2.0.1, xmonad-0.8.1, xmonad-contrib-0.8.1, zlib-0.5.0.0 /home/kyagrd/.ghc/i386-linux-6.10.1/package.conf: Cabal-1.6.0.1, Cabal-1.6.0.2, GLFW-0.3, HGL-3.2.0.0, HTTP-3001.1.3, HTTP-4000.0.4, HTTP-4000.0.5, InfixApplicative-1.0.1, QuickCheck-1.2.0.0, QuickCheck-2.1.0.1, Stream-0.3.1, arrows-0.4.1, binary-0.5.0.1, cgi-3001.1.7.1, data-accessor-0.2.0.2, data-accessor-monads-fd-0.2, data-accessor-template-0.2.1.1, derive-0.1.4, extensible-exceptions-0.1.1.0, filepath-1.1.0.2, fingertree-0.0, ghc-paths-0.1.0.5, haddock-2.4.1, haskell98-1.0.1.0, irc-0.4.3, lazysmallcheck-0.3, (monads-fd-0.0.0.1), network-2.2.0.1, network-2.2.1, old-time-1.0.0.2, parsec-2.1.0.1, pointedlist-0.3.1, process-1.0.1.1, pureMD5-0.2.4, random-1.0.0.1, regex-tdfa-1.0.0, rosezipper-0.1, sparsebit-0.5, split-0.1.1, terminfo-0.3.0.2, transformers-0.1.4.0, uniplate-1.2.0.3, unix-compat-0.1.2.1, utility-ht-0.0.4, vty-3.1.8.4, yi-0.6.0, zlib-0.4.0.4, zlib-0.5.0.0 kyagrd@kyagrd:~/cscs/stlcwpat$ ls /usr/lib/*GL* /usr/lib/libGL.so.1@ /usr/lib/libGLU.so.1.3.070300 /usr/lib/libGL.so.180.44 /usr/lib/libGLcore.so.1@ /usr/lib/libGLEW.so.1.5@ /usr/lib/libGLcore.so.180.44 /usr/lib/libGLEW.so.1.5.0 /usr/lib/libQtOpenGL.so.4@ /usr/lib/libGLU.a /usr/lib/libQtOpenGL.so.4.5@ /usr/lib/libGLU.so@ /usr/lib/libQtOpenGL.so.4.5.0 /usr/lib/libGLU.so.1@

Ahn, Ki Yung wrote:
I don't know the exact reason but this should not fail since I have Debian packaged ghc 6.10.1 and OpenGL-2.2.1.1 on my system.
I think this is because the filename of the OpenGL shared library is /usr/lib/libGL.so.1 rather than libGL.so. This is why we have two
No. Do not manually create the symlink. It sounds like you don't have the -dev packages for OpenGL installed. You should install them and then you should be OK.
participants (3)
-
Ahn, Ki Yung
-
John Goerzen
-
Niemeijer, R.A.