Subject: RE: LIBRARY_PATH problems
From: [email-masked] (Kris Thielemans)

18 May 1998 19:01:10 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: <[email-masked]>, "Mumit Khan" <[email-masked]>
Cc: "Gnuwin" <[email-masked]>

Hi Earnie,

ok, I should have done another test to convince you. (All this started out
because gcc didn't find my libraries in the first place, without having
duplicate directory names around).

New tests:
3)
- I make a directory /ll, and put libX11.a in there
- I make sure there is no ll directory on any other drive, certainly not on
d:
- I set LIBRARY_PATH=//d/ll (or /home/ll)
- gcc -v -lX11 does find the X11 library, and the -v option tells you it
found it in /ll (=c:\ll)

4)
- I remove the c:\ll, and make a d:\ll, put libX11.a
- keep LIBRARY_PATH=//d/ll
- gcc -lX11 does not find the library

I hope I convinced you this time...

Kris

----------------------test 3 -----------------------
(look at the -L\ll option passed to ld)

bash-2.01$ rmdir //d/ll
bash-2.01$ ls /ll
dummy     libX11.a
bash-2.01$ LIBRARY_PATH=//d/ll
bash-2.01$ gcc -v -lX11
Reading specs from
d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)

d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../.
../../i386-cygwin3
2\bin\ld.exe
d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../.
../../
i386-cygwin32\lib\crt0.o -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cy
gwin32\egcs-2.90.2
7 -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib -L\ll -Ld:\Cygnus\B19\H-i386-c
ygwin32\lib\gcc-li
b\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib -Ld:\Cygnus\B19\H
-i386-cygwin32\lib
\gcc-lib\i386-cygwin32\egcs-2.90.27\../../.. -lX11 -lgcc -lcygwin -lkernel32
 -ladvapi32 -lshel
l32 -lgcc
d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../.
../../i386-cygwin32
\lib/libcygwin.a(libcmain.o)(.text+0x58):libcmain.cc: undefined reference to
`WinMain@16'

----------------------test 4 -----------------------
(now there is no relevant -L option passed to ld, as gcc figures first out
that \ll does not exist...)

bash-2.01$ rm -r /ll
bash-2.01$ mkdir //d/ll
bash-2.01$ cp /usr/X11R6.3/lib/libX11.a  //d/ll
bash-2.01$ ls //d/ll
libX11.a
bash-2.01$ gcc -v -lX11
Reading specs from
d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)

d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../.
../../i386-cygwin3
2\bin\ld.exe
d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../.
../../
i386-cygwin32\lib\crt0.o -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cy
gwin32\egcs-2.90.2
7 -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib -Ld:\Cygnus\B19\H-i386-cygwin3
2\lib\gcc-lib\i386
-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib -Ld:\Cygnus\B19\H-i386-
cygwin32\lib\gcc-l
ib\i386-cygwin32\egcs-2.90.27\../../.. -lX11 -lgcc -lcygwin -lkernel32 -ladv
api32 -lshell32 -l
gcc
/usr/H-i386-cygwin32/i386-cygwin32/bin/ld.exe: cannot open -lX11: No such
file or directory>

 -----Original Message-----
> From: Earnie Boyd [mailto:[email-masked]]
> Sent: 16 May 1998 13:28
> To: Kris Thielemans; Mumit Khan
> Cc: Gnuwin
> Subject: Re: LIBRARY_PATH problems
>
>
>
>
> This is _NOT_ a problem with gcc.
>
> This problem is with cygwin.
>
> If you have paths of the same name on different drives, cygwin will
> often become confused as to which to use.
>
>
> ---Kris Thielemans <[email-masked]> wrote:
> >
> >
> > Hi Mumit,
> > (I forward this to the list now as I can be more specific now)
> >
> > I'm using egcs 1.0.2 (on Cygwin b19.1), on a NT 4.0 sp3 machine.
> Using the
> > LIBRARY_PATH variable has apparently a problem when the specified
> directory
> > is not on the c: drive (probably this should read "on the drive
> mounted as
> > /").
> >
> > I did the following:
> > 1)
> > - copy a library (I'll take libX11.a as example) to c:\ll
> > - LIBRARY_PATH=/ll
> > - gcc -lX11 finds the library correctly
> > - remove c:\ll\*, but keep the (empty) directory
> >
> > 2)
> > - copy that library to d:\ll
> > - LIBRARY_PATH=//d/ll or d:/ll or /home/ll (as I have d:\ mounted as
> /home)
> > or even or d:\ll
> > - gcc -lX11 does not find the library in any of these 4 cases
> > - running gcc with the -v option shows that an option -L/ll (or
> -L\ll in the
> > last case) is passed to ld, that is, the drive letter is simply
> discarded
> > (after some processing of mount tables and //d syntax).
> > (Note that you'll see this only when you have c:\ll present)
> > - gcc -lX11 -L$LIBRARY_PATH works in all 4 cases
> >
> > 3) I tried similar things with more complicate paths (and
> mountings). The
> > result is always the same: gcc strips (only) the drive letter from
> the path
> > given in LIBRARY_PATH.
> >
> > I hope this is reproducible (and clear enough).
> >
> > Kris
> >
> > PS:
> > an example (where I've added the *** in  the output of gcc to guide
> your
> > eye, silly lines breaks are because I copy paste from an NT window).
> >
> > bash-2.01$ LIBRARY_PATH=//d/ll
> > bash-2.01$ gcc -v -lX11
> > Reading specs from
> >
> d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\specs
> > gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
> >
> >
> d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.
> 27\../../.
> > ./../i386-cygwin3
> > 2\bin\ld.exe
> >
> d:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\egcs-2.90.
> 27\../../.
> > ./../
> > i386-cygwin32\lib\crt0.o
> -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cy
> > gwin32\egcs-2.90.2
> > 7 -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib  ***-L\ll ***
> > -Ld:\Cygnus\B19\H-i386-cygwin32\lib\gcc-li
> > b\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib
> -Ld:\Cygnus\B19\H
> > -i386-cygwin32\lib
> > \gcc-lib\i386-cygwin32\egcs-2.90.27\../../.. -lX11 -lgcc -lcygwin
> -lkernel32
> >  -ladvapi32 -lshel
> > l32 -lgcc
> > /usr/H-i386-cygwin32/i386-cygwin32/bin/ld.exe: cannot open -lX11: No
> such
> > file or directory
> >
> >
> >
> > bash-2.01$ mount
> > Device           Directory           Type        Flags
> > d:\Cygnus\B19    /usr                native      text=binary
> > d:               /home               native      text!=binary
> > \\.\tape1:       /dev/st1            native      text!=binary
> > \\.\tape0:       /dev/st0            native      text!=binary
> > \\.\b:           /dev/fd1            native      text!=binary
> > \\.\a:           /dev/fd0            native      text!=binary
> > c:               /                   native      text!=binary
> >

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".