[CMake] static library linking

Steven Van Ingelgem steven at vaningelgem.be
Sun Jun 15 15:58:39 EDT 2008


Hi Alan,


It doesn't want to link with the -Bstatic... But it links nicely with the
static paths...
In fact on the system is only 1 libpthread.a ... And that's not what is
getting linked against because it returns errors related to symbols which
cannot be found in the .so (somehow).

I have no idea what's going on, but getting a list of ld which libraries it
will link would certainly be helpful.


Thanks

2008/6/15 Alan W. Irwin <irwin at beluga.phys.uvic.ca>:

> On 2008-06-15 19:28+0200 Steven Van Ingelgem wrote:
>
>  Hi Alan,
>>
>>
>> I don't know why, but if I take the build command from cmake, and I insert
>> the static libraries in there, it works all right. So somehow it's
>> reverting
>> itself to some other version of the static and/or dynamic libraries.
>>
>
> You would only link to a dynamic library if there was a bug in ld on your
> system so that -Bstatic was ignored.  That's unlikely, but please exclude
> that possibility completely by running "ldd -r" on the executable to get a
> complete list of shared libraries that are being used (and also the -r
> option gives you any unresolved symbols for your executable).
>
> If you are getting the wrong static library, then that means you have some
> library search path where something other than /usr/lib is first on that
> path.  I wonder if you have the wrong version of the static library in
> /usr/local/lib, and that path is first on the library search path for your
> distro?
>
>
>> The entire point of me reporting this in fact is that in cmake cvs this
>> should have been resolved... Meaning that if I say in my CMakeLists file
>> to
>> link against the static library, it should just keep that link... Not try
>> to
>> be smart and change it ;-).
>>
>
> You might be right, but I think you have to make your case with more
> detail.
> IOW, please do everything you can to identify the actual library being used
> by the -Wl,-Bstatic -lpthread compiler option on your system.  I mentioned
> "ldd -r" above to eliminate one (remote) possibility.  Also, I assume there
> is a way to get the linker (ld) to list the actual static libraries it
> uses,
> but my linker knowledge doesn't stretch that far. _Thus, I hope some linker
> expert here will be able to tell you how to do that._ But if nobody else
> comments, perhaps you can find the alternative static library on your
> system
> and infer you are using that (for example, if "nm" on the alternate static
> library shows none of the symbols that "ldd -r" shows are undefined for the
> executable).
>
> Note, I am not a CMake developer, but I do have an interest in linking
> issues which is why I am curious as to why -Wl,-Bstatic -lpthread is not
> doing the expected thing on your system.
>
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting
> software
> package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
> Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080615/4edb3be0/attachment-0001.htm>


More information about the CMake mailing list