Re: order of -L options created by gcc for the linker

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tjevon writes:
 > 
 > I'm having a problem with gcc placing the default gcc libraries 
 > (-L/usr/lib/gcc/x86_64-redhat-linux/3.4.5) ahead of the correct (newer)
 > versions in the list of arguments being passed to ld. 
 > 
 > In particular, if I specify -Wl,-L/usr/local/ext/lib in the line passed to
 > gcc, the resultant ld command will have the default location of libraries
 > for gcc prior to my -L/usr/local/ext/lib entry. As a result, the linker trys
 > to link older libraries and fails.a
 > 
 > In contrast, if I specify -L/usr/local/ext/lib in the line passed to gcc (no
 > -Wl), the resultant ld command will have -L/usr/local/ext/lib prior to the
 > gcc default library location and the link proceeds without error.
 > 
 > Why is this? I thought gcc would take any -Wl specified option and pass it
 > straight on to ld, I wasn't expecting a different placement within the
 > resultant command line.
 > 
 > This is causing a problem for me because our current build environment does
 > not support a method for generating the -L without -Wl.
 > 
 > Are there other arguments that can be passed to gcc so that my -L path is
 > before the compilers?
 > 
 > Any help in understanding this would be appriciated.

This doesn't make any sense.  gcc always links the versions of the
libraries that are compatible with the gcc version that's installed.
If you have a newer version of gcc installed, with newer libraries,
the new gcc will link against the new libraries.

I find it hard to imagine what kind of a broken setup would give the
problems you're describing.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux