Subject: Re: Re: library path for libopengl32
From: "Tim Bregulla" <[email-masked]>
To: [email-masked]
Date: Fri, 24 Aug 2001 12:02:11 +0200

Here my results:

>From: Andre Bleau <bleau at igb dot umontreal dot ca> 
>Date: Thu, 23 Aug 2001 17:01:01 -0400 
>
>You will find instructions about compiling and linking OpenGL programs in
>/usr/doc/opengl-1.1.0/README.txt .

>The correct order of librairies for linking is -lglut32 -lglu32 -lopengl32 .

Ok I tried that with no avail. What I said: the linking with the Cygwin libs goes without errors. It is only happening with mingw32 libs.

>/usr/include/mingw/GL should be a soft link to /usr/include/GL ; otherwise 
>the OpenGL is not installed properly.

this part is working since my compiler does not complain, only the linker (for mingw32)

I copied all the /usr/lib/mingw files and sub-dirs into /usr/lib. Then I got the same error "undefined references" messages for Cygwin.

I really think it is a wrong specs file I have. And there is a second one under the mingw path
/lib/mingw/gcc-lib/mingw32/2.95.3-4

Is this also used from the compilers? I always believed the first one in
 /lib/gcc-lib/i686-pc-cygwin/2.95.2-7 is the important file.

I heard that you could change lib pathes during configure with -prefix. 
But I have one running GCC with two targets: Cygwin and MinGW32. 
How can I set up the real library pathes at link time in the specs?

>
>André Bleau, Cygwin's OpenGL package maintainer.

>>
Hello

I am trying to compile a OpenGL demo in a Cygwin environment with two targets: 
Cygwin and MinGW32 via -mnocygwin. The first demo goes fine while the second complains about undefined references.
 I looked into the libopengl32.a files: the one from MinGW32 also has them.

My includes for Cygwin are under /usr/include, 
for MinGW under /usr/include/mingw

My libs for Cygwin are under /lib, 
for MinGW under /lib/mingw

It seems that my specs are ignored since the paths contain also the Cygwin setting -L/bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7 in both targets.
 Where is that directory stored? 

And how can I write the specs right?
At least, did I use the correct libgcc.a for each target?

Thanks for your help

gcc -v -Wall -c demo1.o demo1.c
Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/specs
gcc version 2.95.2-7 19991024 (cygwin experimental)
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/cpp.exe -lang-c -v -iprefix /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/ -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386 -Asystem(winnt) -Acpu(i386) -Amachine(i386) -Wall -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/local/include -idirafter /usr/include demo1.c /cygdrive/c/WINNT/Temp/ccYTV7lw.i
GNU CPP version 2.95.2-7 19991024 (cygwin experimental) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/include
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/../../../../include/g++-3
End of omitted list.
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/cc1.exe /cygdrive/c/WINNT/Temp/ccYTV7lw.i -quiet -dumpbase demo1.c -Wall -version -o /cygdrive/c/WINNT/Temp/cc7ZRFrC.s
GNU C version 2.95.2-7 19991024 (cygwin experimental) (i686-pc-cygwin) compiled by GNU C version 2.95.2-7 19991024 (cygwin experimental).
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/../../../../i686-pc-cygwin/bin/as.exe -o demo1.o /cygdrive/c/WINNT/Temp/cc7ZRFrC.s
gcc: demo1.o: linker input file unused since linking not done

gcc -v -Wall   -o demo1 demo1.o -lglut32 -lopengl32 -lglu32 -lm
Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/specs
gcc version 2.95.2-7 19991024 (cygwin experimental)
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/collect2.exe -Bdynamic -o demo1.exe /usr/lib/crt0.o -L/bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7 -L/bin/../lib/gcc-lib -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7 -L/usr/lib/mingw demo1.o -lglut32 -lopengl32 -lglu32 -lm -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc

the last again as
gcc -print-file-name=libopengl32.a -Wall   -o demo1 demo1.o -lglut32 -lopengl32 -lglu32 -lm
/usr/lib/libopengl32.a

and here for MinGW32

gcc -mno-cygwin -v -Wall -c demo1.o demo1.c
Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/specs
gcc version 2.95.2-7 19991024 (cygwin experimental)
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/cpp.exe -lang-c -v -iprefix /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/ -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386 -Asystem(winnt) -Acpu(i386) -Amachine(i386) -Wall -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__MSVCRT__ -DWINNT -DWIN32 -D_WIN32 -D__WIN32__ -D__MINGW32__=1.0 -isystem /usr/local/include/mingw -idirafter /usr/include/mingw -iwithprefixbefore /usr/include/mingw/g++-3 demo1.c /cygdrive/c/WINNT/Temp/ccDzojfE.i
GNU CPP version 2.95.2-7 19991024 (cygwin experimental) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/include
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/include
 /usr/include/mingw
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/../../../../include/g++-3
End of omitted list.
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/cc1.exe /cygdrive/c/WINNT/Temp/ccDzojfE.i -quiet -dumpbase demo1.c -mno-cygwin -Wall -version -o /cygdrive/c/WINNT/Temp/cca5ASGo.s
GNU C version 2.95.2-7 19991024 (cygwin experimental) (i686-pc-cygwin) compiled by GNU C version 2.95.2-7 19991024 (cygwin experimental).
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/../../../../i686-pc-cygwin/bin/as.exe -o demo1.o /cygdrive/c/WINNT/Temp/cca5ASGo.s
gcc: demo1.o: linker input file unused since linking not done

gcc -mno-cygwin -v -Wall   -o demo1 demo1.o -lglut32 -lopengl32 -lglu32 -lm
Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/specs
gcc version 2.95.2-7 19991024 (cygwin experimental)
 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7/collect2.exe -Bdynamic -o demo1.exe -L/lib/mingw /usr/lib/mingw/crt2.o -L/bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2-7 -L/bin/../lib/gcc-lib -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7 -L/usr/lib/mingw demo1.o -lglut32 -lopengl32 -lglu32 -lm -L/lib/mingw/gcc-lib/mingw32/2.95.3-4 -lmingw32 -lmoldname -lmsvcrt -lgcc -lmingw32 -luser32 -lkernel32 -ladvapi32 -lshell32 -L/lib/mingw/gcc-lib/mingw32/2.95.3-4 -lmingw32 -lmoldname -lmsvcrt -lgcc
demo1.o(.text+0x17):demo1.c: undefined reference to `__glutInitWithExit'
demo1.o(.text+0x37):demo1.c: undefined reference to `__glutCreateWindowWithExit'
demo1.o(.text+0x5b):demo1.c: undefined reference to `__glutCreateMenuWithExit'
demo1.o(.text+0x97):demo1.c: undefined reference to `glMatrixMode'
demo1.o(.text+0xc5):demo1.c: undefined reference to `gluPerspective'
demo1.o(.text+0xd5):demo1.c: undefined reference to `glMatrixMode'
demo1.o(.text+0x10f):demo1.c: undefined reference to `gluLookAt'
demo1.o(.text+0x11f):demo1.c: undefined reference to `glClear'
demo1.o(.text+0x13f):demo1.c: undefined reference to `glClear'
demo1.o(.text+0x159):demo1.c: undefined reference to `glColor3f'
demo1.o(.text+0x166):demo1.c: undefined reference to `glBegin'
demo1.o(.text+0x181):demo1.c: undefined reference to `glVertex3f'
demo1.o(.text+0x195):demo1.c: undefined reference to `glVertex3f'
demo1.o(.text+0x1a9):demo1.c: undefined reference to `glVertex3f'
demo1.o(.text+0x1b1):demo1.c: undefined reference to `glEnd'
demo1.o(.text+0x1b6):demo1.c: undefined reference to `glutSwapBuffers'
demo1.o(.text+0x210):demo1.c: undefined reference to `glutInitDisplayMode'
demo1.o(.text+0x225):demo1.c: undefined reference to `glutInitWindowSize'
demo1.o(.text+0x234):demo1.c: undefined reference to `glutInitWindowPosition'
demo1.o(.text+0x25a):demo1.c: undefined reference to `glutDisplayFunc'
demo1.o(.text+0x26a):demo1.c: undefined reference to `glutKeyboardFunc'
demo1.o(.text+0x272):demo1.c: undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status

the last again as

gcc -mnocygwin -print-file-name=libopengl32.a -Wall   -o demo1 demo1.o -lglut32 -lopengl32 -lglu32 -lm
/usr/lib/libopengl32.a

and now the specs file

*asm:

*asm_final:

*cpp:
-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE}   %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/local/include -idirafter /usr/include}   %{mno-win32: %{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}}   %{mno-cygwin: -D__MSVCRT__ -DWINNT -DWIN32 -D_WIN32 -D__WIN32__ -D__MINGW32__=1.0  %{mthreads:-D_MT} -isystem /usr/local/include/mingw  -idirafter /usr/include/mingw     -iwithprefixbefore /usr/include/mingw/g++-3 }    %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT      -idirafter /usr/include/w32api}

*cc1:
%(cc1_spec) 

*cc1plus:

*endfile:

*link:
%{mwindows:--subsystem windows}   %{mconsole:--subsystem console}   %{shared: %{mdll: %eshared and mdll are not compatible}}   %{shared: --shared} %{mdll:--dll}   %{static:-Bstatic} %{!static:-Bdynamic}   %{shared|mdll: -e     %{mno-cygwin:_DllMainCRTStartup@12}     %{!mno-cygwin:__cygwin_dll_entry@12}}

*lib:
%{pg:-lgmon}   %{!mno-cygwin:-lcygwin}   %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32}   %{mwindows:-lgdi32 -lcomdlg32}   -luser32 -lkernel32 -ladvapi32 -lshell32

*libgcc:
%{mno-cygwin: -L/lib/mingw/gcc-lib/mingw32/2.95.3-4 %{mthreads:-lmingwthrd} -lmingw32} %{mno-cygwin:-lmoldname -lmsvcrt} -lgcc 

*libstdc++:
{!lgcc: %{mno-cygwin: -L/lib/mingw/gcc-lib/mingw32/2.95.3-4 %{mthreads:-lmingwthrd} -lmingw32} %{mno-cygwin:-lmoldname -lmsvcrt}} -lstdc++

*startfile:
%{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}   %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s}     %{mno-cygwin:-L/lib/mingw mingw/crt2%O%s}   %{pg:gcrt0%O%s}}}

*switches_need_spaces:

*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}

*predefines:
-Di386 -D__386__ -D__i386 -D_X86=1 -D__STDC__=1   -D__stdcall=__attribute__((__stdcall__))   -D__cdecl=__attribute__((__cdecl__))   -D__declspec(x)=__attribute__((x))   -Asystem(winnt) -Acpu(i386) -Amachine(i386)

*cross_compile:
0

*version:
2.95.2-7

*multilib:
. ;

*multilib_defaults:

*multilib_extra:

*multilib_matches:

*linker:
collect2

*cpp_486:
%{!ansi:-Di486} -D__i486 -D__i486__

*cpp_586:
%{!ansi:-Di586 -Dpentium} 	-D__i586 -D__i586__ -D__pentium -D__pentium__

*cpp_k6:
%{!ansi:-Di586 -Dk6} 	-D__i586 -D__i586__ -D__k6 -D__k6__

*cpp_686:
%{!ansi:-Di686 -Dpentiumpro} 	-D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__

*cpp_cpu_default:
%(cpp_686)

*cpp_cpu:
-Acpu(i386) -Amachine(i386) %{!ansi:-Di386} -D__i386 -D__i386__ %{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} %{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} %{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} %{mcpu=k6:%(cpp_k6)} %{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}

*cc1_cpu:
%{!mcpu*: %{m386:-mcpu=i386 -march=i386} %{m486:-mcpu=i486 -march=i486} %{mpentium:-mcpu=pentium} %{mpentiumpro:-mcpu=pentiumpro}}

*mingw_include_path:
/usr/include/mingw

*link_command:
%{!fsyntax-only:  %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} 			%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}			%{!A:%{!nostdlib:%{!nostartfiles:%S}}}			%{static:} %{L*} %D %o			%{!nostdlib:%{!nodefaultlibs:%G %L %G}}			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}			%{T*}			
 }}}}}}
<<
_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
[email-masked], 8MB Speicher, Verschluesselung - http://freemail.web.de

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/