SOLVED. Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.

Hello,
ghc -package GLUT -lglut Hello1.hs -o Hello1 --- works! :)
I'm not sure why I must specify "-package GLUT" and "-lglut" but that
prevents the linker errors. Also, shouldn't configure correctly figure out
how to link the GLUT libraries? Can someone explain?
Thank you.
__
Donnie
On Sat, Sep 20, 2008 at 9:47 PM, Donnie Jones
Hello Clifford,
Thank you for the quick reply. I was able to get a test C program that draws a triangle with GLUT to work: gcc -lglut triangle.o -o triangle.exe
However, when building the Haskell GLUT 'Hello World' it uses, -lGLU to link GLUT, but that does not work; however, from the config.log output configure seems to think that -lGL should work. Is there a way I can change the build to use -lglut? Maybe with configure I can specify that -lglut is the correct way to link the GLUT libraries?
Thank you! __ Donnie
On Sat, Sep 20, 2008 at 3:42 PM, Clifford Beshers < clifford.beshers@gmail.com> wrote: It works for me. I'm running Ubuntu Hardy with some packages built by us at SeeReason (see debs.seereason.com).
It looks like ghc can't find your glut libraries (not the Haskell wrappers, but the real GLUT libs). Try 'ghc -v --make ' and look at the linking lines and see what GHC is specifying (mine shows a -lglut). Try compiling an example C program against GLUT and see if that works.
My package list looks like this: beshers@blue:~/haskell$ dpkg -l \*glut\* Desired=Unknown/Install/
Remove/Purge/Hold | Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description
+++-==============-==============-============================================ un freeglut-dev <none> (no description available) ii freeglut3 2.4.0-6 OpenGL Utility Toolkit ii freeglut3-dev 2.4.0-6 OpenGL Utility Toolkit development files un glut-doc <none> (no description available) un glutg3 <none> (no description available) un glutg3-dev <none> (no description available) ii libghc6-glut-d 2.1.1.1-2+3see Haskell GLUT binding for GHC un libghc6-glut-d <none> (no description available) un libghc6-glut-p <none> (no description available) un libglut <none> (no description available) un libglut-dev <none> (no description available) pn libglut3 <none> (no description available) un libglut3-dev <none> (no description available)
On Sat, Sep 20, 2008 at 1:13 PM, Donnie Jones
wrote: Hello Brandon,
On Sat, Sep 20, 2008 at 1:02 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2008 Sep 20, at 12:57, Donnie Jones wrote:
checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking OpenGL/glu.h usability... no checking OpenGL/glu.h presence... no checking for OpenGL/glu.h... no
That looks like to me that the gl.h and glu.h header files were found and are usable (in some cases). I am able to build
Yes, you have the header. But it says nothing about whether -lGLU was found, and that's where your problems are. Also, that's configure output, not config.log output (which has a transcript of the tests, not just the summary).
### Relevant lines that include "-lGL" or "-lGLU" in config.log ### configure:4634: checking for GL library configure:4670: gcc -o conftest -g -O2 conftest.c -lGL -lm >&5 configure:4676: $? = 0 configure:4696: result: -lGL -lm configure:4773: checking for GLU library configure:4809: gcc -o conftest -g -O2 conftest.c -lglu32 -lGL -lm
&5 /usr/bin/ld: cannot find -lglu32
collect2: ld returned 1 exit status configure:4815: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME "Haskell OpenGL package" | #define PACKAGE_TARNAME "OpenGL" | #define PACKAGE_VERSION "2.2.1" | #define PACKAGE_STRING "Haskell OpenGL package 2.2.1" | #define PACKAGE_BUGREPORT "sven.panne@aedion.de" | /* end confdefs.h. */ | #include <GL/glu.h> | int | main () | { | gluNewQuadric() | ; | return 0; | } configure:4809: gcc -o conftest -g -O2 conftest.c -lGLU -lGL -lm >&5 configure:4815: $? = 0 configure:4835: result: -lGLU -lGL -lm ... fp_cv_check_GLU_lib='-lGLU -lGL -lm ' fp_cv_check_GL_lib='-lGL -lm ' ... GLU_LIBS=' -lGLU -lGL -lm ' ... GL_LIBS=' -lGL -lm ' ... #define GLU_LIBS "-lGLU" ,"-lGL" ,"-lm" ########################################
It seems like the OpenGL and GLUT libraries are found (after -lglu32 fails, I am using Debian Linux). I am not sure what to try now.
Thank you for the help. :) __ Donnie
participants (1)
-
Donnie Jones