Re: /usr/local/{include,lib} on Cygwin

From: Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com>
To: Pete Forman <pete(dot)forman(at)WesternGeco(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-ports(at)postgresql(dot)org
Subject: Re: /usr/local/{include,lib} on Cygwin
Date: 2001-03-08 14:45:32
Message-ID: 20010308094532.B576@dothill.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports

Pete,

On Thu, Mar 08, 2001 at 10:48:00AM +0000, Pete Forman wrote:
> Jason Tishler writes:
> > Does anyone know how to glean this information from gcc? Should I
> > actually be asking ld?
>
> Giving a -v to gcc will explicitly list search paths and more.

Actually, I have been using gcc -v, but its output does not contain
"-L/usr/local/lib". For example,

$ gcc -v -o j j.c -lpth
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/specs
gcc version 2.95.2-7 19991024 (cygwin experimental)
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/cpp.exe -lang-c -v -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) -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 j.c /mnt/c/TEMP/ccGFCuoi.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
/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.
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/cc1.exe /mnt/c/TEMP/ccGFCuoi.i -quiet -dumpbase j.c -version -o /mnt/c/TEMP/ccOkwhdA.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 /mnt/c/TEMP/ccSbZyQX.o /mnt/c/TEMP/ccOkwhdA.s
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7/collect2.exe -Bdynamic -o j.exe /usr/lib/crt0.o -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-7 -L/usr/lib/mingw /mnt/c/TEMP/ccSbZyQX.o -lpth -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc

So from the above, it is clear that Cygwin gcc 2.95.2-7 will search
/usr/local/include for #include files. However, there is no indication
that it will search /usr/local/lib for library files. But, libpth.a is
only located in /usr/local/lib in my system. How does collect2 find it?

I just tried the old faithful, strings:

$ strings /usr/bin/ld.exe | fgrep /usr/local/lib
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/usr/i686-pc-cygwin/lib);
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/usr/i686-pc-cygwin/lib);
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/usr/i686-pc-cygwin/lib);

The above appears to indicate that ld's default library search path is:

/lib:/usr/lib:/usr/local/lib:/usr/i686-pc-cygwin/lib

Is there any way to get ld to tell us this information without resorting
to strings?

Thanks,
Jason

--
Jason Tishler
Director, Software Engineering Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp. Fax: +1 (732) 264-8798
82 Bethany Road, Suite 7 Email: Jason(dot)Tishler(at)dothill(dot)com
Hazlet, NJ 07730 USA WWW: http://www.dothill.com

In response to

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Jason Tishler 2001-03-08 16:45:54 Re: Replace Windows PostgreSQL Binary?
Previous Message Pete Forman 2001-03-08 10:48:00 Re: /usr/local/{include,lib} on Cygwin