This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: paths for headers and libraries
- From: David Byron <dbyron at coactive dot com>
- To: 'Craig Rodrigues' <rodrigc at attbi dot com>
- Cc: "'gcc at gnu dot org'" <gcc at gnu dot org>
- Date: Fri, 15 Feb 2002 16:13:36 -0800
- Subject: RE: paths for headers and libraries
> > On Fri, Feb 15, 2002 at 02:22:39PM -0800, David Byron wrote:
> > When compiling with no switches for modifying the include
> > search path, I see from gcc -v that it's looking in
> > /usr/local/include first. This is fine, except that when
> > linking with -l, and no switches for modifying the library
> > search path, the library gets picked up from /usr/lib.
> >
> > Is this the default behavior of gcc, or some artifact of
> > configure switches or something else?
>
> The linker on your system has a default list of directories
> which it looks for libraries in. This default list is
> compiled directly into the linker.
>
> ld --verbose | grep SEARCH
>
> SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib);
> SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/i386-redhat-linux/lib);
>
> Read the gcc and ld documentation for ways of changing the
> search path. Using the -L flag is one way to do it.
I should have asked another question the first time. Does this setup cause other people grief -- looking in /usr/local first for headers but /usr first for libs? From looking at binutils/ld/genscripts.sh, this seems to be the default. If not, I guess I did something out-of-the-ordinary when installing my duplicate stuff in /usr/local. Since I think looking in /usr/local first is right, I'll move this to the binutils list if it goes much further.
Thanks for your help.
-DB