public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* opengl-1.1.0-10 glut32 linking problems
@ 2009-01-29  1:44 Reini Urban
  2009-01-29  5:09 ` Reini Urban
  0 siblings, 1 reply; 4+ messages in thread
From: Reini Urban @ 2009-01-29  1:44 UTC (permalink / raw)
  To: The Cygwin Mailing List

The importlib /usr/lib/w32api/libglut32.a has some problems. Linking
to the dll directly works fine.

$ cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
int main(int argc, char *argv[])
{
    if(glutInit == NULL) {
        printf("glutInit is NULL\n");
        return EXIT_FAILURE;
    }
    printf("GLUT %d\n",        GLUT_API_VERSION);
    return EXIT_SUCCESS;
}
$ gcc test.c -lglut32 -lglu -lopengl32
undefined reference to `___glutInitWithExit'
undefined reference to `___glutCreateWindowWithExit'
undefined reference to `___glutCreateMenuWithExit'
$ 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
-- 
Reini Urban
http://phpwiki.org/              http://murbreak.at/

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opengl-1.1.0-10 glut32 linking problems
  2009-01-29  1:44 opengl-1.1.0-10 glut32 linking problems Reini Urban
@ 2009-01-29  5:09 ` Reini Urban
  0 siblings, 0 replies; 4+ messages in thread
From: Reini Urban @ 2009-01-29  5:09 UTC (permalink / raw)
  To: The Cygwin Mailing List

2009/1/28 Reini Urban:
> The importlib /usr/lib/w32api/libglut32.a has some problems. Linking
> to the dll directly works fine.
>
> $ cat test.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <GL/glut.h>
> int main(int argc, char *argv[])
> {
>    if(glutInit == NULL) {
>        printf("glutInit is NULL\n");
>        return EXIT_FAILURE;
>    }
>    printf("GLUT %d\n",        GLUT_API_VERSION);
>    return EXIT_SUCCESS;
> }
> $ gcc test.c -lglut32 -lglu -lopengl32
> undefined reference to `___glutInitWithExit'
> undefined reference to `___glutCreateWindowWithExit'
> undefined reference to `___glutCreateMenuWithExit'
> $ gcc test.c /bin/glut32.dll -lglu -lopengl32
>
> $ ./a
> GLUT 3

> I see nothing problematic, but I'm no expert

And to answer the libsearch patch question, about being shadowed from
another libglut:

$ gcc --verbose test_1676.c -lglut32 -lglu32 -lopengl32 2>&1 |grep collect2

$ /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe --verbose -Bdynamic
--dll-search-prefix=cyg
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o
-L/usr/lib/gcc/i686-pc-cygwin/3.4.4
-L/usr/lib/gcc/i686-pc-cygwin/3.4.4
-L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. test.o -lglut32 -lglu32
-lopengl32 -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32
-lgcc 2>&1 |grep succeed

attempt to open /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o succeeded
attempt to open test.o succeeded
attempt to open /usr/lib/w32api/libglut32.a succeeded
attempt to open /usr/lib/w32api/libglu32.a succeeded
attempt to open /usr/lib/w32api/libopengl32.a succeeded
attempt to open /usr/lib/gcc/i686-pc-cygwin/3.4.4/libgcc.a succeeded
attempt to open /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a succeeded
attempt to open /usr/lib/w32api/libuser32.a succeeded
attempt to open /usr/lib/w32api/libkernel32.a succeeded
attempt to open /usr/lib/w32api/libadvapi32.a succeeded
attempt to open /usr/lib/w32api/libshell32.a succeeded
attempt to open /usr/lib/gcc/i686-pc-cygwin/3.4.4/libgcc.a succeeded

Everything looks okay to me here also

-- 
Reini Urban
http://phpwiki.org/              http://murbreak.at/

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opengl-1.1.0-10 glut32 linking problems
@ 2009-02-06 19:24 André Bleau
  0 siblings, 0 replies; 4+ messages in thread
From: André Bleau @ 2009-02-06 19:24 UTC (permalink / raw)
  To: cygwin


Hi Reini,
 
In January, you wrote about some problems linking with opengl-1.1.0-10's glut32.a .
I answered on January 29th, asking for some extra info and offering some advice.
Could you please tell us if the problem is now solved?
 
This might help other users if they run into a similar problem.
 
- 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opengl-1.1.0-10 glut32 linking problems
@ 2009-01-29 16:00 André Bleau
  0 siblings, 0 replies; 4+ messages in thread
From: André Bleau @ 2009-01-29 16:00 UTC (permalink / raw)
  To: cygwin


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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-06 19:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29  1:44 opengl-1.1.0-10 glut32 linking problems Reini Urban
2009-01-29  5:09 ` Reini Urban
2009-01-29 16:00 André Bleau
2009-02-06 19:24 André Bleau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).