Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

32 views
Skip to first unread message

Donnie Jones

unread,
Sep 20, 2008, 10:11:17 PM9/20/08
to Brandon S. Allbery KF8NH, hop...@haskell.org, Haskell-cafe
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 <don...@darthik.com> wrote:

> 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...@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 <don...@darthik.com> wrote:
>
>> Hello Brandon,
>>
>> On Sat, Sep 20, 2008 at 1:02 PM, Brandon S. Allbery KF8NH <
>> all...@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....@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
>>
>>
>

Brandon S. Allbery KF8NH

unread,
Sep 20, 2008, 10:13:57 PM9/20/08
to Donnie Jones, hop...@haskell.org, Haskell-cafe
On 2008 Sep 20, at 22:10, Donnie Jones wrote:
> 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?

You're overriding the information recorded by ghc-pkg (which is used
if you use ghc --make).

As for why configure doesn't work, I think you'd have to let someone
who knows the HOpenGL build stuff look at your system.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] all...@kf8nh.com
system administrator [openafs,heimdal,too many hats] all...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH


kaz...@gmail.com

unread,
Nov 17, 2008, 3:52:19 AM11/17/08
to
Hi,

On Sep 21, 11:11 am, "Donnie Jones" <don...@darthik.com> wrote:
> 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?

I guess the configure script does not correctly check GLUT library.

From what I read from the script, the package seems to depend on Xmu
and Xi libraries, but it does not check existence of these. If you do
not have these libraries installed, the check for liblut somehow goes
okay without configuraing correct linker flag for libglut.

So, to solve this problem,

- Install Xmu and Xi libraries, or
- Fix the configure script to check those libraries. I don't know the
package really depnds on them, though.

Kazuya

--
http://www.violentlyhappy.org/kazuya

0 new messages