[gmx-developers] Re: help needed: static builds with cmake
roland at utk.edu
Fri Oct 29 00:11:11 CEST 2010
On Thu, Oct 28, 2010 at 3:47 PM, Szilárd Páll <szilard.pall at cbr.su.se>wrote:
> >> 1) works fine, but referring to file extensions/endings might not be
> >> general enough. Making it more general/robust would require rewriting
> >> the way external libraries are treated: instead of adding them with
> >> full path we'd need to add -Lpath -llibname separately. However, this
> >> needs quite a bit more time than I have now...
> > I'm confused, is the later part ( -Lpath -llibname separately) part of
> > 2nd step below. Or not? Why does it take a lot of time?
> Probably not a lot, but it smells like it's is/might turn out to be
> more then I have ATM :)
> The cmake find scripts (maybe not all, but most) do not return a
> separate library name and library path.
Now I understand. BTW: their is a CMAKE_STATIC_LIBRARY_SUFFIX. You can use
that instead of specifying ".a" directly.
> >> 2) Should work with the target property LINK_SEARCH_END_STATIC which
> >> essentially puts a -Wl,-Bstatic (for gcc on Linux, but it's supposed
> >> to work on many platforms) at the end of the final link call argument
> >> list.
> > If the later part of step 1 above has not been done, than how does it
> > to set "-Wl,-Bstatic"? Does it use the static version even when you
> > the library file with the full path?
> From the Cmake docs:
> "LINK_SEARCH_END_STATIC: End a link line such that static system
> libraries are used."
> If I understand correctly, when "-Wl,-Bstatic" is placed at the end of
> the link argument list it does not affect the arguments that precede
> it and therefor 1) and 2) could work together, just that if e.g. fftw
> is only available as shared library, this would be linked in
Too me this looks like a bug in cmake. It has
(in Modules/Platform/Linux.cmake) LINK_STATIC_C_FLAGS "-Wl,-Bstatic". But I
think it should include the -static for gcc. It might have been sufficient
to have the Wl,-Bstatic but at least now gcc requires also the static
option. If you agree we should file a cmake bug report.
Does step 1 apply to the gromacs internal libraries (libmd, libgmx, ..)? If
so, I think step 1 by itself is good enough.
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gromacs.org_gmx-developers