[gmx-developers] Re: help needed: static builds with cmake
Justin A. Lemkul
jalemkul at vt.edu
Fri Oct 29 00:18:00 CEST 2010
Roland Schulz wrote:
>
>
> On Thu, Oct 28, 2010 at 3:47 PM, Szilárd Páll <szilard.pall at cbr.su.se
> <mailto: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 the
> > 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 help
> > to set "-Wl,-Bstatic"? Does it use the static version even when
> you specify
> > 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
> dynamically.
>
>
> 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.
>
I don't know a whole lot about the ins and outs of compiler options, but I do
know that on Mac OSX systems, gcc -static can frequently cause problems, i.e.:
http://stackoverflow.com/questions/844819/how-to-static-link-on-os-x
-Justin
> Does step 1 apply to the gromacs internal libraries (libmd, libgmx, ..)?
> If so, I think step 1 by itself is good enough.
>
> Roland
>
> --
> ORNL/UT Center for Molecular Biophysics cmb.ornl.gov <http://cmb.ornl.gov>
> 865-241-1537, ORNL PO BOX 2008 MS6309
>
--
========================================
Justin A. Lemkul
Ph.D. Candidate
ICTAS Doctoral Scholar
MILES-IGERT Trainee
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080
http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin
========================================
More information about the gromacs.org_gmx-developers
mailing list