is there any way to change the order of name resolution in linking (aside from putting the libraries in the right order?)
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Sep 30 10:00:00 GMT 2012
On 30 September 2012 02:05, Dan Hitt wrote:
> Thanks Sundara.
>
> Actually, i tried several variations to try to specify the extension.
>
> These are the variations i tried, with the results:
> -lX11 (found, but does not resolve symbols)
At the start of the link line there are no symbols to resolve. If
-lX11 finds both libX11.so and libX11.a then it will prefer the shared
library, and --whole-archive doesn't affect shared libraries.
> -lX11a (cannot find)
This looks for a library called libX11a.so or libX11a.a so obviously won't work.
> -lX11.a (cannot find)
This looks for libX11.a.so or libX11.a.a, so won't work.
> lX11 (cannot find)
This looks for a file called lX11 in the current dir.
> libX11 (cannot find)
> libX11a (cannot find)
> libX11.a (cannot find)
> llibX11.a (cannot find)
Similarly, these look for files with that exact name in the current dir.
> -llibX11.a (cannot find)
This looks for liblibX11.a.so or liblibX11.a.a, so won't work.
> Just for reference, these go in the arguments as
> -Wl,--whole-archive,<<library goes here>>,--no-whole-archive
>
> and so far, the only things that don't bail are -lX11 and
> /usr/lib/...../libX11.a,
> and the latter is the only thing that actually resolves any symbols.
You could make the former work (e.g. with --no-as-needed or -static)
but giving the full path to the static archive works too.
More information about the Gcc-help
mailing list