On 12/16/2010 02:20 PM, frobnoid@xxxxxxxxx wrote:
I'm looking for documentation on what influences gcc's default search dirs for libraries (as shown via gcc -print-search-dirs). I'm hoping to avoid a dive into the gcc code and/or trial and error in tweaking my build environment to determine this, but that's my next steps if this list can't provide me with any alternatives.
I think it's a mistake to consider this as a function of gcc: we have to follow the system ABI, whatever it says. So, any answer to this question will be very system-specific. A few generalities, though: we alsways first search gcc's own libraries and then we search whatever libraries the system provides. On my system it looks like this: Gcc's built-in dirs: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../x86_64-redhat-linux/lib/x86_64-redhat-linux/4.5.1/: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../x86_64-redhat-linux/lib/../lib64/: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../x86_64-redhat-linux/4.5.1/: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/: The system dirs: /lib/x86_64-redhat-linux/4.5.1/: /lib/../lib64/: /usr/lib/x86_64-redhat-linux/4.5.1/: /usr/lib/../lib64/: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../x86_64-redhat-linux/lib/: /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../: /lib/: /usr/lib/
The background: I'm trying to build gcc (4.1.2) and running into some complications regarding the default search order for 32 and 64 bit libraries. In some environments I'm finding the 32 bit libraries first, and in some I'm finding the 64 bit libraries first.
This is very odd: you should either be searching the 64-bit or the 32-bit library directories, depending on which architecture you're building for. I wonder if you're getting stuck with a Debian "pure64" system. Andrew.