This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

paths for headers and libraries

I'm confused about where gcc looks for header files and libraries regarding /usr/local.  I've got one version of a library and header file installed in /usr/include and /usr/lib, and a different version installed in /usr/local/include and /usr/local/lib.

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?  Is there some way to set things up so I don't have to explicitly specify -L/usr/local/lib for every executable I build that uses this dually-installed library?

Sorry if this is a FAQ.

Thanks much.


GNU CPP version 2.95.2 20000220 (Debian GNU/Linux) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
End of search list.

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)

$ gcc -print-search-dirs
install: /usr/lib/gcc-lib/i386-linux/2.95.2/
programs: /usr/lib/gcc-lib/i386-linux/2.95.2/:/usr/lib/gcc-lib/i386-linux/:/usr/lib/gcc/i386-linux/2.95.2/:/usr/lib/gcc/i386-linux/:/usr/i386-linux/bin/i386-linux/2.95.2/:/usr/i386-linux/bin/
libraries: /usr/lib/gcc-lib/i386-linux/2.95.2/:/usr/lib/gcc/i386-linux/2.95.2/:/usr/i386-linux/lib/i386-linux/2.95.2/:/usr/i386-linux/lib/:/usr/lib/i386-linux/2.95.2/:/usr/lib/:/lib/i386-linux/2.95.2/:/lib/:/usr/lib/i386-linux/2.95.2/:/usr/lib/

$ uname -a
Linux porto 2.2.18pre21 #4 SMP Mon Apr 23 18:58:11 PDT 2001 i686 unknown
David Byron           
Coactive Networks, Inc.
28 Liberty Ship Way             voice:(415)289-7800
Sausalito, CA  94965            fax:(415)289-1320

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]