delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/29/10:13:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_28,J_CHICKENPOX_43,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <COL104-W16687026FDFFBFECCDCE2593C90@phx.gbl>
Reply-To: <cygwin AT cygwin DOT com>
From: =?iso-8859-1?Q?Andr=E9_Bleau?= <andre_bleau AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
Subject: Re: opengl-1.1.0-10 glut32 linking problems
Date: Thu, 29 Jan 2009 10:13:03 -0500
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi Reini,
=20
Reini Urban  wrote:
=20
> The importlib /usr/lib/w32api/libglut32.a has some problems. Linking
> to the dll directly works fine.
>=20
> $ cat test.c
> #include=20
> #include=20
> #include=20
> int main(int argc, char *argv[])
> {
>     if(glutInit =3D=3D NULL) {
>         printf("glutInit is NULL\n");
>         return EXIT_FAILURE;
>     }

I really don't know what you are trying to do with that test. glutInit is n=
ot called here, you're only checking the address of that function. As it is=
 not loaded dynamically, it can only be different from NULL, otherwise link=
ing would have failed.
=20
>     printf("GLUT %d\n",        GLUT_API_VERSION);
>     return EXIT_SUCCESS;
> }
> $ gcc test.c -lglut32 -lglu -lopengl32
=20
As stated in the opengl-1.1.0-9 and -10 anouncements and in=20
/usr/share/doc/opengl-1.1.0/README.txt , you must now add
-I/usr/include/opengl at compile time to avoid conflicts with freeglut.
=20
Also, the correct linking for glu is -lglu32. It didn't matter here, but it=
 will when you
build a more elaborate program. Please check /usr/share/doc/opengl-1.1.0/RE=
ADME.txt .

> undefined reference to `___glutInitWithExit'
> undefined reference to `___glutCreateWindowWithExit'
> undefined reference to `___glutCreateMenuWithExit'
=20
libglut32.a was part of the w32api package before version 3.13-1 . If you h=
ave=20
w32api-3.12-1 or older, you're getting libglut32.a from the w32api package,=
 not the one=20
from the opengl package. The opengl package depends on the w32api package, =
so updating the
opengl package should have updated the w32api package first.
=20
What is the result of:
cygcheck -c opengl
cygcheck -c w32api
cygcheck -c libglut3
cygcheck -c libglut-devel
?

> $ gcc test.c /bin/glut32.dll -lglu -lopengl32
>=20
> $ ./a
> GLUT 3
>=20
> Note that there are two more ___glut* functions, not only these three.
> $ nm /lib/w32api/libglut32.a | grep " ___glut"
> 00000000 T ___glutSetFCB AT 8
> 00000000 T ___glutInitWithExit AT 12
> 00000000 T ___glutGetFCB AT 4
> 00000000 T ___glutCreateWindowWithExit AT 8
> 00000000 T ___glutCreateMenuWithExit AT 8
> $ objdump -t /lib/w32api/libglut32.a | grep " ___glut"
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ___glutSetFCB AT 8
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ___glutInitWith=
Exit AT 12
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ___glutGetFCB AT 4
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> ___glutCreateWindowWithExit AT 8
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> ___glutCreateMenuWithExit AT 8
>=20
> I see nothing problematic, but I'm no expert
=20
What is the output of ls -l /usr/lib/w32api/libglut32.a ?
=20
It should match:
Fri Dec  5 15:57:41 2008          90472 usr/lib/w32api/libglut32.a
from the opengl-1.1.0-10 package; otherwise, you have the file from an old =
w32api package.
=20
You can also try:
=20
gcc test.c /usr/lib/w32api/libglut32.a -lglu32 -lopengl32
=20
To check if -lglut32 leads to the right thing.

> --=20
> Reini Urban
=20
HTH,
=20
- Andr=E9 Bleau, Cygwin's volunteer OpenGL package maintainer.
=20
Please direct any question or comment about the OpenGL package to cygwin at=
 cygwin dot com


=20
_________________________________________________________________


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019