This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: opengl-1.1.0-10 glut32 linking problems


Hi Reini,
 
Reini Urban  wrote:
 
> The importlib /usr/lib/w32api/libglut32.a has some problems. Linking
> to the dll directly works fine.
> 
> $ cat test.c
> #include 
> #include 
> #include 
> int main(int argc, char *argv[])
> {
>     if(glutInit == 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 not 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 linking would have failed.
 
>     printf("GLUT %d\n",        GLUT_API_VERSION);
>     return EXIT_SUCCESS;
> }
> $ gcc test.c -lglut32 -lglu -lopengl32
 
As stated in the opengl-1.1.0-9 and -10 anouncements and in 
/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.
 
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/README.txt .

> undefined reference to `___glutInitWithExit'
> undefined reference to `___glutCreateWindowWithExit'
> undefined reference to `___glutCreateMenuWithExit'
 
libglut32.a was part of the w32api package before version 3.13-1 . If you have 
w32api-3.12-1 or older, you're getting libglut32.a from the w32api package, not the one 
from the opengl package. The opengl package depends on the w32api package, so updating the
opengl package should have updated the w32api package first.
 
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
> 
> $ ./a
> GLUT 3
> 
> Note that there are two more ___glut* functions, not only these three.
> $ nm /lib/w32api/libglut32.a | grep " ___glut"
> 00000000 T ___glutSetFCB@8
> 00000000 T ___glutInitWithExit@12
> 00000000 T ___glutGetFCB@4
> 00000000 T ___glutCreateWindowWithExit@8
> 00000000 T ___glutCreateMenuWithExit@8
> $ objdump -t /lib/w32api/libglut32.a | grep " ___glut"
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ___glutSetFCB@8
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ___glutInitWithExit@12
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ___glutGetFCB@4
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> ___glutCreateWindowWithExit@8
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> ___glutCreateMenuWithExit@8
> 
> I see nothing problematic, but I'm no expert
 
What is the output of ls -l /usr/lib/w32api/libglut32.a ?
 
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.
 
You can also try:
 
gcc test.c /usr/lib/w32api/libglut32.a -lglu32 -lopengl32
 
To check if -lglut32 leads to the right thing.

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


 
_________________________________________________________________


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]